0

list. append with negative integer?

why does this code keep pushing 7 outside are they different elements? light= [[1]] def add_value(): light.append ([light[-1],7]) print(light) add_value() add_value() add_value() ------------------------------------------- output [[1], [[1], 7]] [[1], [[1], 7], [[[1], 7], 7]] [[1], [[1], 7], [[[1], 7], 7], [[[[1], 7], 7], 7]]

23rd May 2020, 4:23 AM
Jah Revelo
Jah Revelo - avatar
1 ответ
0
Thanks
23rd May 2020, 3:59 PM
Jah Revelo
Jah Revelo - avatar