I am a c++ programmer and am learning pygame so I am very new to python. I noticed this behavior of functions and don't know what to do about it:
let's say we have a global variable:
x = 10
Now let's say we have a function that changes the value of x:
def foo():
x = 100
Now, inside my main pygame loop, if I call foo(), the variable x is still 10 after the function call. How is this happening???