Crossin的编程教室

标题: 出入Python疑问第一帖~~求解答 [打印本页]

作者: holiday    时间: 2017-3-31 14:56
标题: 出入Python疑问第一帖~~求解答
import random
secret=random.randint(1,100)
guess=0
tries=0
print"AHOY! I'm the Dread Pirate Roberts,and Ihave 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 yer guess?")
    if guess<secret:
        print"Too low,ye scurvy dog!"
        elif guess>secret:     ---------------------------我按F5运行提示错误的语法,请问这里要怎么修改?我是对着图片上面打的。
            print"Too high,landlubber!"
            tries=tries+1
            if guess==secret:
                print"Avast! Ye got it! Found my secret,ye did!"
                elif:
                    print"N more guesses! Better luck next time,matey!"
                    print"The secret number was",secret

python01.png (168.67 KB, 下载次数: 389)

python01.png


作者: holiday    时间: 2017-3-31 17:50
问群里的前辈已经解答了,是因为缩进的问题,感谢大家!




欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) Powered by Discuz! X2.5