from random import *
a = randint(1,100)
guess = 0
while True:
num = input("guessed number:")
guess += 1
if not num.isdigit():
print("please input a number")
elif int( num) < 0 or int(num) >=100:
print("The entered number is out of range!")
else:
if int(num) == a:
print("Congratulations on your guess!")
elif int( num) > a:
print("The number you entered is too large!")
elif int(num) < a:
print("The number you entered is too small!")
else:
print("An unknown error has occurred in the system, please contact the staff personnel to deal with it!")
Number guessing game in python
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326775373&siteId=291194637
Recommended
Ranking