【发布时间】:2017-10-24 19:10:04
【问题描述】:
如何检查用户输入值的列表是否为 5 的倍数?我需要能够打印出这些值中有多少是 5 的倍数。例如:
intList = [5, 10, 11, 15]
"75% of values in intList are multiples of 5"
到目前为止,这是我的代码:
intList = []
running = True
while running:
intAmount = int(input("Enter the amount of integers you are inputting: "))
if intAmount > 0:
running = False
for i in range (intAmount):
integers = int(input("Enter an integer here: "))
intList.append(integers)
print(intList)
【问题讨论】:
标签: list function python-3.6 defined