guessing game in python using while loop
import random
# These are the two limits to make the game interesting...
upper_limit = random.randint(0, 50)
lower_limit = random.randint(50, 100)
# This is the answer... It has to be outside the while loop or else it will keep on changing thus making the game weird.
answer = random.randint(upper_limit, lower_limit)
# The loop of the game to allow trials after failure and break when the gamer gueses correctly
while True:
guess = int(input("Guess a number: "))
if guess == answer:
print(" Amazing")
break
if guess > answer:
print(" Too High")
if guess < answer:
print(" Too Low")