我收到以下代码错误,我不明白它有什么问题。
我只是想学习如何做到这一点,这是一个测试。
我不知道出了什么问题或如何解决它。
print "Would you like to see today's weather?"
answer = input
if answer = "yes":
print "Follow Link: http://www.weather.com/weather/right-now/Yorktown+VA+23693 "
elif answer = "no":
print "Very well, would you like to play a guessing game?"
if answer = "yes":
import random
secret = random.randint (1, 99)
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 = input("What's your guess? ")
if guess < secret:
print "Too low, ye scurvy dog!"
elif guess > secret:
print "Too high, landlubber!"
tries = tries + 1
if guess == secret:
print "Avast! Ye got it! Found my secret ye did!"
elif answer = "no":
print "Thank you, and goodnight."