+ 2

Can anybody explain me that code? How it comes to "4"?

*x,y = [1,2], [3,4], [5,6], print(list(zip(*x+[y]))[1][1])

23rd Nov 2017, 1:10 PM
Yuri Shelkov
Yuri Shelkov - avatar
3 odpowiedzi
23rd Nov 2017, 2:06 PM
Oma Falk
Oma Falk - avatar
+ 2
code playground is your helper. and read help for zip and * -operator. list(zip(*x+[y])) generates [(1,3,5),(2,4,6)]
23rd Nov 2017, 2:05 PM
yuri
0
Thanks a lot. Everything's clear.
23rd Nov 2017, 2:08 PM
Yuri Shelkov
Yuri Shelkov - avatar