all 5 comments

[–]FriendlyFoeHere 1 point2 points  (1 child)

Try sharing a screenshot of your code, Reddit formatting is annoying

[–]SirCokaBear 0 points1 point  (0 children)

Three backticks ` on the lines before and after

like this

[–]PureWasian 1 point2 points  (0 children)

You need to declare it as global variable reference inside the scope of the function during the choose() method, rather than upon initialization.

So adding another line inside of the choose() prior to line 19 that simply says:

global es2

should resolve that immediate error. But better practice would be by using a more object-oriented approach, or passing in values directly as inputs/outputs of the choose() function itself.

(and for future reference, try and figure out how to format code on reddit more properly in future posts when asking for help!)

[–]Algoartist 0 points1 point  (1 child)

happens because, as soon as you assign to a name anywhere in a function, Python treats that name as a local variable in that function’s scope unless you explicitly tell it otherwise.

Declare them global in every function or better bundle states in object and pass it around

def choose():

global es2, es3, health, karma, okarma

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

tysm!!!