First page Back Continue Last page Overview Graphics

Guessing Number Game

Write a program, which lets a human player guess a number between a number range from 1 to n. The player inputs his gues. The program informs the player, if this number is larger, smaller or equal to the secret number, i.e. the number which the program has randomly created.

Hint: It's possible to create a random number between 1 and 20 with the following code:

import random

n = 20

to_be_guessed = random.randint(1,n)