4月20 之前寫的shopping回顧

enumerate() 函數用於將一個可遍歷的數據對象(如列表、元組或字符串)組合爲一個索引序列,同時列出數據和數據下標,一般用在 for 循環當中。 isdigit:判斷是否爲數字 a = input(「what you want to buy」) if a.isdigit(): a=int(a) a -= 1 print(product_list[int(a)])
相關文章
相關標籤/搜索