展开全部
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 you guess?"))
if guess
print("Too low,ye scurvy dog!")
elif guess>secret:
print("Too high,landlubber!")
tries=tries+1
if guess==secret:
print("Avast !You got it ! Found my secret,you did!")
else:
print("No more guesses!Better luck next time,matey!")
print("The secret number was",secret)
python是依靠缩32313133353236313431303231363533e59b9ee7ad9431333335306163进判断语句块的,因此while,if的子语句要多缩进一个单位
学的什么书,告诉一下,省得下次答的时候还是自己敲代码