|
初學者常犯的錯誤,千萬不能少寫判斷語句啊!(不要把程序語言當人類語言看,程序語言是給電腦看的)
- a = 0
- b = 0
- c = 0
- # -------------- 你的代碼(錯) --------------
- if a and b and c == 0:
- print("pass")
- else:
- print("fail")
- # -------------- 正確寫法如下 --------------
- if a == 0 and b == 0 and c == 0:
- print("pass")
- else:
- print("fail")
复制代码 |
|