为了账号安全,请及时绑定邮箱和手机立即绑定

入门猜数字游戏哪里错了呢?tries=tries+1没用上!

入门猜数字游戏哪里错了呢?tries=tries+1没用上!

明月笑刀无情 2018-09-08 11:23:28
import randomsecret = random.randint(1,100)guess = 0tries = 0print( "AHOY! I'm the dread Pirate roberts, and I have a secret!")print("It is a number from 1 to 99. I'll give you 6 tries.")while guess !=secret and tries < 6:guess = int(input("what's yer guess?"))if guess < secret:     print ("too low") elif guess > secret:     print("too high")      tries=tries+1     if guess == secret:     print("down!")else:    print("no more")    print("the secret was",secret)
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 953 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信