随笔分类 - 猜数字游戏
import random
s=random.randint(1,100)
g=0
t=0
while g!=s:
t=t+1
g=input("请输入你猜的数")
if eval(g)s:
print("数字有点大")
else:
print("你猜对了")
print("你猜的次数为{}次".format(t))
break
摘要:import randoms=random.randint(1,100)g=0t=0while g!=s: t=t+1 g=input("请输入你猜的数") if eval(g)<s: print("数字有点小") elif eval(g)>s: print("数字有点大") else: print
阅读全文

浙公网安备 33010602011771号