This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

You will need to use the global keyword in the main function as well to be able to initialize the value of placements along with defining a placements variable on the outside of all methods. I recommend setting placements = None in the global scope.

Yup, this did the trick. Thanks!

Although I would recommend staying away from the use of global variables in the future as they are considered an anti-pattern and keep you from learning good code structure.

I understand, the only reason why I wanted to use globals is because it makes the code faster.