June 2021
Beginner
432 pages
9h 9m
English
Guess the Number is a classic game for beginners to practice basic programming techniques. In this game, the computer thinks of a random number between 1 and 100. The player has 10 chances to guess the number. After each guess, the computer tells the player if it was too high or too low.
When you run guess.py, the output will look like this:
Guess the Number, by Al Sweigart al@inventwithpython.com
I am thinking of a number between 1 and 100.
You have 10 guesses left. Take a guess.
> 50
Your guess is too high.
You have 9 guesses left. Take a guess.
> 25
Your guess is too low.
--snip-- You have 5 ...Read now
Unlock full access