Hard to describe it, ref below codes, pls
For the var item1, I wonder:
Section1, item1's value is an element of lst, a tuple. but from Section2, items1's value goes to next level, is an element of an element of lst.
how to understand this?
import random
lst1 = [random.randint(1, 100) for i in range(10)]
lst2 = [random.randint(1, 100) for i in range(10)]
lst = list(zip(lst1, lst2))
print(lst)
# section 1
for item1 in lst:
print(item1)
# section 2
for item1, item2 in lst:
print(item1, item2)
output example:
[(34, 85), (9, 18), (56, 89), (69, 82), (21, 69), (21, 46), (39, 78), (19, 27), (33, 71), (94, 2)]
section1:
(34, 85)
...
(94, 2)
section2:
34 85
...
94 2
how come from section1 item1 = (34, 85) but item1 just = 34 from section2