Guessing Game

A simple guessing game, where the computer picks a number between 1 and 100, allowing the player to guess a number, to which the game returns whether the number to be guessed is either bigger, smaller or equal to the guessed number. The game continues until the player has guessed the correct number.

 import random

print("This is a simple guessing game where you will guess a number between 1 and 100, and the computer will return whether the number is higher or lower.")
number = random.randint(1, 100)
guess = -1
while guess != number:
guess = int(input("Enter your guess: "))
if guess > number:
print("The number is smaller!")
elif guess < number:
print("The number is larger!")
elif guess == number:
print("That is the number!")
break

Comments