Python出现问题"或"

时间:2017-01-27 23:29:23

标签: python

所以我遇到了新问题,也许有人可以提供帮助?如果我将国家改为M,它就不再起作用了。它应该打印"谢谢"如果国家是米或M.

nation = "m"
type = 1
if nation == ("m" or "M") and type == 1:
    print("Thanks")

1 个答案:

答案 0 :(得分:0)

nation = "m"
type = 1
if (nation == "m" or nation == "M") and type == 1:
    print("Thanks")