Python guessing game.

How to use: First enter a maximum number, then enter a minimum number, then the program will randomly generate a random number in the interval, try to enter a number, it will jump out correctly, and the error message will be too large or too small.

import random
maxx=int(input("请输入最大数"))
minn=int(input("请输入最小数"))
a=random.randint(minn,maxx)
while True:		
	b=int(input("请输入数字"))		
	if b>a:				
		print("你输入的数字大了")	
	elif b<a:				
		print("你输入的数字小了")		
	else:				
		print("恭喜你输入正确\n游戏结束")	
		break

Guess you like

Origin blog.csdn.net/m0_71542110/article/details/126398309