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)])
相关文章
相关标签/搜索