从随机数中,猜数游戏
import random
number = random.randint(1,10)
print("猜数游戏开始啦,你只有3次机会哦")
n = 0
while n < 3:
temp=input("请输入你的数字:")
num1 = int(temp)
if(num1==number):
print("猜对啦")
break
else:
if(num1>number):
print("猜大了")
else:
print("猜小了")
n = n+1
print("猜数游戏结束")
慢慢积累,脚踏实地