4月20 之前写的shopping回顾
4月20 之前写的shopping回顾
enumerate() 函数用于将一个可遍历的数据对象(如列表、元组或字符串)组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中。
4月20 之前写的shopping回顾

isdigit:判断是否为数字

a = input(“what you want to buy”)
if a.isdigit():
a=int(a)
a -= 1
print(product_list[int(a)])

相关文章:

  • 2021-12-09
  • 2022-03-11
  • 2021-05-24
  • 2022-12-23
  • 2021-04-21
  • 2021-05-15
  • 2021-10-09
猜你喜欢
  • 2021-07-04
  • 2021-08-12
  • 2021-04-22
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案