Code Lab BetaBUILD. RUN. DISCOVER.
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
PYTHON STRUCTURES / CHAPTER 06 / Learn / LESSON 05
Assignment does not copy a list automatically:
a = [1, 2]
b = a
b.append(3)
print(a) # [1, 2, 3] — shared referencea.copy() or list(a) makes a shallow copy. For dicts: dict.copy() or {**d}.
Learn: shared ref vs copy.
DECISION STANDBY
›