猜数字
程序员文章站
2024-01-13 10:33:28
num=56 for i in range(3): guess_num=int(input('输入你猜的数字:')) if guess_num==num: print('恭喜你猜对了') break elif guess_num > num: print('你猜的数字大了') else: print ......
num=56
for i in range(3):
guess_num=int(input('输入你猜的数字:'))
if guess_num==num:
print('恭喜你猜对了')
break
elif guess_num > num:
print('你猜的数字大了')
else:
print('你猜的数字小了')
else:
print('你猜的次数过多,game over')