我正在编写一个简短的程序来获取十个数字并将它们重新打印为列表,但将低于一定数量的数字替换为零。首先,“输入”不起作用并提示我提供数字。其次,对于主函数中的第二个“for”循环,我得到了“TypeError:‘int’object not iterable”。有什么想法吗?
amx = []
def validamount(amount, limit):
if amount >= limit:
return amount
else:
return 0
def main():
for i in 10:
amx.append(int(input()))
for i in 10:
print(validamount(amx[i], 5))
main()
最佳答案
关于python - 为什么我收到 Typeerror : 'int' object not iterable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28354945/