jeudi 20 juin 2019

For loop does not print numbers that end with 0?

Suppose that 'i' is 90 and 90%10 = 0, it does not print 90.

numbers = [1,100]
for i in numbers:
    if i%10 == 0:
        print(i)

Output:

100

Should be: 10, 20 ... 100?

Aucun commentaire:

Enregistrer un commentaire