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?
2 Answers
+ 4
This question will helpĂ·
https://www.sololearn.com/discuss/1584927/?ref=app
+ 3
https://code.sololearn.com/cWgu3oXx8NTV/?ref=app