$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #166

What is the output?

a = [1, 2]
b = a + [3]
print(a)
  1. [1, 2]
  2. [1, 2, 3]
  3. [3]
  4. Error
+ builds a new list, so a is untouched — unlike append, which mutates in place.
Play Problem Solving ▸