输出是'All Right !!!'在这两种情况下。请说明原因。 此外,由于“偏离主题”,我之前的问题被删除了。这一个好吗?
ans2=input("Are You Ready???")
if ans2=="yes" or "Yes":
print("All right!!!")
elif ans2=="No" or "no":
print("OK maybe next time")
答案 0 :(得分:0)
ans2 == "yes" or "Yes"
将始终评估为true,因为or
的第二部分为“是”,这是一个真正的值。解决方案是将其更改为:
ans2 == "yes" or ans2 == "Yes"