Assignment to "global" variables within functions does not change the variable in the outer scope - it creates new local variables with similar names.
The proper way is to pass the value to function as argument and to return value to the outer scope form your function.
The proper way is to pass the value to function as argument and to return value to the outer scope form your function.
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.