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

import random
secret = random.randint(1,100)
guess = 0
tries = 0

print( "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)


明月笑刀无情
浏览 954回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python