小编one*_*cah的帖子

为什么"No"作为raw_input在以下python代码中返回TRUE?

我不能为我的生活理解为什么无论我输入什么我都无法得到"别的"陈述.任何见解都会非常感激.我不允许使用多个"或"?

print "Do you want to go down the tunnel? "

tunnel = raw_input ("> ")

if tunnel == "Y" or "Yes" or "Yea" or "Si" or "go" or "Aye" or "Sure":
    print "You found the gold."
else:
    print "Wrong answer, you should have gone down the tunnel. There was gold down there."
Run Code Online (Sandbox Code Playgroud)

python boolean

4
推荐指数
1
解决办法
2602
查看次数

标签 统计

boolean ×1

python ×1