+ 2
18th May 2020, 1:42 PM
Alen Antony
Alen Antony - avatar
5 Antworten
+ 2
That's just what zip does: Returning a tuple of the n-th elements of your iterables.
18th May 2020, 1:49 PM
HonFu
HonFu - avatar
+ 1
Use [ ] brackets for list and ( ) For tuples
18th May 2020, 1:45 PM
Ashraf Vp
Ashraf Vp - avatar
+ 1
Can you explain the function zip() and list(), why list() should be used twice?
18th May 2020, 1:54 PM
Alen Antony
Alen Antony - avatar
+ 1
There is no need to use list twice in this code. It can be done like this: a = range(10) print(list(zip(a, a))[9]) # or like this: ( when 2 different ranges should be used like print(list(zip(range(0,10), range(3,13)))[9]) print(list(zip(range(10), range(10)))[9])
18th May 2020, 2:08 PM
Lothar
Lothar - avatar
0
Thanks
18th May 2020, 2:02 PM
Alen Antony
Alen Antony - avatar