设为首页收藏本站

Crossin的编程教室

 找回密码
 立即加入
查看: 8844|回复: 1
打印 上一主题 下一主题

出入Python疑问第一帖~~求解答

[复制链接]

1

主题

0

好友

7

积分

新手上路

Rank: 1

跳转到指定楼层
楼主
发表于 2017-3-31 14:56:21 |只看该作者 |倒序浏览
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, 下载次数: 234)

python01.png

回复

使用道具 举报

1

主题

0

好友

7

积分

新手上路

Rank: 1

沙发
发表于 2017-3-31 17:50:27 |只看该作者
问群里的前辈已经解答了,是因为缩进的问题,感谢大家!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

QQ|手机版|Archiver|Crossin的编程教室 ( 苏ICP备15063769号  

GMT+8, 2024-5-2 08:58 , Processed in 0.016753 second(s), 24 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部