samedi 1 février 2020

Could someone explain what is going on in this code? [duplicate]

I'm trying to get the for loop to delete b from the list, but for some reason it wants to delete e.

a=10
b=4
c=30
d=40
e=50
f=60
numbers = [a,b,c,d,e,f]

for number in numbers:
    if number <5:
        del numbers[number]
        print(numbers)

Aucun commentaire:

Enregistrer un commentaire