0

What did happen with my list?

a=[2,4,6,8] b=a b[0]=7 a[3]=9 b.append(5) print (a) Why have i got [7,4,6,9,5]?

24th Nov 2019, 9:22 PM
Quarz
2 Respuestas
+ 4
a and b are identical (because of a=b line) and each operation on one of them will apply to another. b [0]=7 => a [0]=7 a [3]=9 => b [3]=9 b.append (5) => b [4]=5 => a [4]=5 And finally: a=[7,4,6,9,5]
24th Nov 2019, 9:30 PM
Qasem