0
One more answer from a challenge that Iâm not understanding
def extend(num, list = []): list.append(num) return list x = extend(1) y = extend(2) print(x, y) ///////////// output: [1, 2] [1, 2] I get why âyâ is [1, 2] but x confuses me a lot
3 Answers
+ 1
~ swim ~ so what you are saying is that since the list is stored in both x and y variables, then once y has changed the list, x is going to store that most recent change of the list?