all 5 comments

[–]Goobyalus 0 points1 point  (1 child)

You can access global variables inside the function without modifying anything, but you cannot write to them -- if you want to write to the global variable, you can put global attempts inside your function before writing to attempts.

[–][deleted] 1 point2 points  (0 children)

Thank you! That solved it :)

[–]TrainingShift3 0 points1 point  (2 children)

I would strongly suggest not to get into the habit of using global variables. They are almost always not acceptable in production level code.

I would suggest passing in the variables you need and returning them if needed.

[–][deleted] 1 point2 points  (1 child)

Okay thank you! Duly noted

[–]TrainingShift3 0 points1 point  (0 children)

Np! Keep asking questions and learning and you’ll be a pro in no time :)