第四讲猜数字游戏独立完成打卡
import randomscert=random.randint(1,20)
print ("猜数字游戏")
temp=input("猜猜系统生成的随机数是多少呢:")
guess=int(temp)
while guess!=scert:
temp=input("不对不对,再猜猜看")
guess=int(temp)
if guess==scert:
print ("运气真好,猜对了")
else:
if guess>scert:
print ("太大了,往小猜猜")
else:
print("太小了,往大了猜猜")
print ("游戏结束!感谢大家")
页:
[1]