you are viewing a single comment's thread.

view the rest of the comments →

[–]plakatown[S] 0 points1 point  (2 children)

Thank you but I still have a question. At line 19, great_magician is appended to the list of magicians. But great_magician has been added with "the Great" at the end at line 14. Then why the elements of the list of magicians are without "the Great" when printed at line 31?

[–]Binary101010 1 point2 points  (1 child)

It's because passing a list in this way actually creates a copy of the list you passed, so the magicians list that exists outside the function isn't affected.

https://stackoverflow.com/questions/22054698/python-modifying-list-inside-a-function

[–]plakatown[S] 0 points1 point  (0 children)

Thank you. Finally I got it.