September 2026
1051 pages
35h 4m
English
As an introduction to programming with Python, we’ll now create a small sample program—the Guessing Numbers game. The idea of the game is as follows: The player should guess a number specified in the program. For this purpose, they can make as many attempts as they like. After each attempt, the program informs them whether the guessed number was too big, too small, or exactly right. Once the player guesses the number, the program outputs the number of attempts and exits. From the player's point of view, the whole thing should look like this:
Guess: 42Too smallGuess: 10000Too bigGuess: 999Too smallGuess: 1337Great, it took you only 4 attempts!
Let's now switch from the flow protocol to the actual implementation in Python. ...
Read now
Unlock full access