Dark theme

Answer


So, did you work out the issue? The problem is one of immutability. Strings are immutable objects, which means that when we pass them into a function they are copied rather than linked to. This means that the variables inside the function are different (though with a copy of the content) from the variables outside, which carry on as they were before. There's a couple of solutions to this.

Firstly, set the name_list as global (in which case we can't also have a parameter with the same name): test4.py

Secondly, and perhaps better, return the altered list, and replace the list outside the function with the returned list: test5.py

This was a tricky one, so if you got as far as even thinking the issue was to do with immutability, congrats!