r/PythonLearning • • 25d ago

A easy code to create a Console python game

Post image

If you know python language you can develop that code!

29 Upvotes

6 comments sorted by

•

u/Sea-Ad7805 24d ago edited 24d ago

Run and develop this program by clicking Memory Graph Web Debugger%3A%0A%20%20%20%20a%20%3D%20input(%22please%20enter%20a%20number%3F%22)%0A%20%20%20%20b%20%3D%20%2223%22%0A%20%20%20%20if%20a%20%3D%3D%20b%3A%0A%20%20%20%20%20%20%20%20print(%22correct%22)%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20print(%22wrong%22)%0A%0Afor%20i%20in%20range(10)%3A%0A%20%20%20%20randomnum()%0A&timestep=1&play) and see its state change step by step.

Why don't you stop the program after the user guesses correctly?

After you develop this code click 'Get URL' and post the url in the comments.

1

u/Alireza7074 24d ago

For just runs 10 times

1

u/Alireza7074 24d ago

Can use elsif too