小编sup*_*ova的帖子

elif块没有在Python中执行

这有什么不对?在输入3(<= 5)时,输出应该是,我认为,"Phew,......"但它仍然是"很棒,......"

weather = raw_input('How is the weather today, from 0 to 10? ')
answer = raw_input ('Are you in mood to go out? ')
if weather >= 5:
    if answer == 'Yes':
        print 'Awesome, I will go out!'
        print 'Will you come with me?'
    else:
        print 'Awesome, I am going out now!'
elif weather <= 5:
    print "Phew, I didn't want to go outside, great, I will stay in! Thank God!"
else:
    print "Huh?"
Run Code Online (Sandbox Code Playgroud)

python if-statement

2
推荐指数
1
解决办法
86
查看次数

标签 统计

if-statement ×1

python ×1