0

Python. List.

Explain me the difference between these two codes, please: list_1 = [x for x in range(4)] list_2 = list_1 list_1 += [7] print(list_1 == list_2) # -> True list_3 = [x for x in range(4)] list_4 = list_3 list_3 = list_3 + [7] print(list_3 == list_4) # -> False Obviously, the only difference is: list_3 = list_3 + [7] and list_1 += [7], but how does it affect the outcome?

30th Dec 2018, 9:00 AM
Tsypa
Tsypa - avatar
2 Respostas
30th Dec 2018, 9:08 AM
Pulkit Kamboj
Pulkit Kamboj - avatar
+ 3
https://code.sololearn.com/cWgu3oXx8NTV/?ref=app
30th Dec 2018, 9:11 AM
Gordon
Gordon - avatar