-
What is Code?
-
Data
-
Input
-
Functions
-
Boolean logic and decisions
-
Loops
-
Modules
-
Examples
-
Exercises
Guess The Number Game
Write a program where the player has to guess the number.
The program will pick a random number and store it, but not print it out. The player takes turns picking numbers until they guess correctly.
Then the program will loop, in each loop it will:
- get the player's guess
- if the answer is higher than the guess, print 'higher'
- if the answer is lower than the guess, print 'lower'
- if the answer is equal to the guess, print a winning message and exit
- continue to loop until the guess is equal to the answer