0

Am I able to use variables from outside a function in a function?

Hi, I am making a simple game in python and I have unknownword function in it, which tells the player, the keyword, he entered does not exist and takes 5 of each stat from him, when executing the code, the console tells me "local variable 'food' referenced before assignment" I have a value of 100 assigned to it before defining the function, what is wrong?

12th Oct 2017, 12:18 PM
Rohnek Kdosi
2 odpowiedzi
+ 1
please share your code
12th Oct 2017, 12:59 PM
Daniel
Daniel - avatar
+ 1
It's ok, I had a bad interpreter, thanks
12th Oct 2017, 1:07 PM
Rohnek Kdosi