deftotal(initial=5,*numbers,vegetables):count=initialfornumberinnumbers:count+=numbercount+=vegetables#這一行為什么不需要for語句呢?returncountprinttotal(10,1,2,3,vegetables=50)運(yùn)行結(jié)果是語法錯(cuò)誤,keyword-only是需要在帶*參數(shù)后面的沒錯(cuò)吧,檢查好久都看不出來哪出問題了呢?(還有,第5行為什么是可以不需要for語句的呢?初學(xué)小白,求教,謝謝!)
關(guān)于keyword-only參數(shù)的一點(diǎn)疑問?
肥皂起泡泡
2019-04-10 20:48:38