0

Help with challenge problem

https://code.sololearn.com/cfu6jJHUvgYC/?ref=app Can someone explain why the output came out the way it is? I thought the output would be [1] [3] since the function sets L as [] when that parameter isnā€™t given.

26th Jun 2022, 1:16 AM
Hubert Huang
2 Answers
0
Because you call it twice. And both lists the function returns are the same list. Proved by printing the id() on both function calls. So it works as it should. What are you trying to do exactly?
26th Jun 2022, 4:11 AM
Slick
Slick - avatar
0
It was one of the challenge problems I got wrong and I wasnā€™t sure about the solution. I understand it now.
26th Jun 2022, 5:11 AM
Hubert Huang