【发布时间】:2019-02-21 06:51:40
【问题描述】:
所以我是 python 新手,并且对于如何根据 num_qc 的值优雅地为产品名称重复此输入有一个完整的心理障碍。
例如,如果 num_qc = 4 我希望用户输入 nam_prod1、nam_prod2 等... 据我了解,我不想预先定义这些变量,因为用户只能为 num_qc 或 50 输入 1?
#report info
num_qc = input('Total QC open: ')
nam_prod = num_qc * input('Name of unit %s: ' % num_qc)
【问题讨论】:
-
使用列表或字典。
标签: python variables input arithmetic-expressions