Create the game
Accept user input
This game will use some of the concepts you learned in the Python Basics section. You will need to know how to use the following concepts. If you are not familiar with any of these, please go back to review them.
You will need to code this game so that it randomly generates a number.
Then the program will repeatedly ask the user for input from the console, and you will need to compare this input to the number that was randomly generated.
What’s the best way to do repeated tasks? You guessed it, loops!
You can use a while
loop to achieve this task.
Within the while
loop, you can use conditionals to check if the player has guessed correctly. If not, you can give them helpful hints whether they should try guessing lower or higher.
Try creating your own game!
Remember to read the comments as a guide; or maybe delete the comments and see if you can figure out on your own. :)
You did it!
Workshop completed!