Total beginner. Please could someone help me fix this code
It is saying that the variable isnt defined even though I define it in the function
Since variables defined within functions are local variables you can't use them outside of that function. Example:
variable = 13 def function(): variable = 3 print(variable)
output > 13
You can try to state the variables earlier and work them into the function or you can go with the nuclear option and make the variables in the function global variables.
also questions like this should be in ask