看板 Python 關於我們 聯絡資訊
各位求救啊! 我在if 的學習中知道,要加判斷式, 像書中綠色筆這裡的為什麼是單獨寫, 是以true false來判斷嗎? https://i.imgur.com/DwrP5j3.jpg
https://i.imgur.com/nJhe7AS.jpg
https://i.imgur.com/EpfDbg7.jpg
----- Sent from JPTT on my iPhone -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.139.99.47 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1628153891.A.059.html
cuteSquirrel: 零: false 非零: true 08/05 17:07
mountain513: 上一層的結果是零 ,被判斷成false , 所以最後一個if 08/05 17:23
mountain513: 08/05 17:23
mountain513: 代入到下層的結果 , 答案是 16 08/05 17:23
mountain513: 請問我的理解有錯嗎 ? 08/05 17:23
goitaly: 沒錯啊 0=false 08/05 17:30
yiche: 兄弟 你知道這書寫的不是Python 嗎 08/05 17:31
a367560: 這個寫法是C吧? 08/05 17:36
TitanEric: 這是C吧 走錯版 08/05 17:58
OrzOGC: 他想用c重寫python吧? 08/05 18:44
shiyeh: 可惡 我在這個版看到括弧會牙起來是正常的嗎...? 08/05 20:23
lycantrope: 是 非0就是 True 08/05 21:29
aassdd926: 這題目很count喔 08/05 23:58
g919233: 這跟我學的python不同 08/06 07:30
ddavid: @shiyeh 括號還好吧,遵守PEP8的話用括號分行的情況很多 08/09 14:12