0
Explanation for below code?
arr=[(5,8,0),(2,4)] sum=[] for x, *y in arr: sum += y print(sum)
1 Réponse
+ 2
for x, *y in arr:
print(x, y)
Output:
5 [8, 0]
2 [4]
Variable "y" takes all the left-over values from each tuple in "arr".
Take a look at the second slide of this lesson to get a better understanding.
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2485/