In my code, I choose 3 numbers in my list. Then I want it to see if there are any multiples of 3 in the list. When I run it, it shows all the multiples of 3 but also runs the else too.
How can you only run the else if there is no multiple of 3?
array = []
for x in range(3):
nums = int(input("What are your numbers? "))
array.append(nums)
print(array)
for i in array:
if i % 3 == 0:
print(i, "Is Multiple of 3")
else:
print("no multiple")
run code,
What are your numbers? 23
What are your numbers? 33
What are your numbers? 6
[23, 33, 6]
33 Is Multiple of 3
6 Is Multiple of 3
no multiple
Process finished with exit code 0