0
Python - Why is the first enumerated value (0) not in the list?
zzz = [1,2,3,4] for i in enumerate(zzz): if i[0] in zzz: print(i[0]) Outputs: 1 2 3 In the for loop, item i is: (0, 1) <--- why is the 0 for i[0] NOT in zzz? (1, 2) (2, 3) (3, 4) Why is " if i[0] in zzz " true only when i[0] is 1, 2, 3 and NOT when i[0] is 0?
1 Odpowiedź
+ 1
indexes are: 0,1,2,3 values are 1,2,3,4.
the indexes contained in list zzz are 1,2,3. zero is not incuded