PYTHON小白求教

[复制链接]
查看11 | 回复4 | 2011-2-21 18:10:32 | 显示全部楼层 |阅读模式
number = 23
guess = int(raw_input('Enter an integer : '))
if guess == number:

print 'Congratulations, you guessed it.' # New block starts here

print "(but you do not win any prizes!)" # New block ends here
elif guessnumber to reach here
print 'Done'
# This last statement is always executed, after the if statement is executed
“#”后边的语句有何作用number = (23)
guess=int(input('Enter an integer : '))
if guess==number:

print ('good')
elif guess<number:

print ('no')
else:

print ('no')
print('done')这样也能运行啊!

回复

使用道具 举报

千问 | 2011-2-21 18:10:32 | 显示全部楼层
Python代码标准要求注释用#在开头标示出来,#后面的都是注释,删除注释当然可以运行……
回复

使用道具 举报

千问 | 2011-2-21 18:10:32 | 显示全部楼层
你是在2.6上跑的吧?print()是python3代替原来print的函数。
回复

使用道具 举报

千问 | 2011-2-21 18:10:32 | 显示全部楼层
注释
回复

使用道具 举报

千问 | 2011-2-21 18:10:32 | 显示全部楼层
不知道你想表达什么意思
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行