Is it possible to change a variable without making a new one in python?
here is an example:
x = True
def reverseX():
x = not x
print(x)
reverseX()
print(x)
now this will return an error because it thinks that I was making a new x in the reverseX thing is there a way for me to use the x that's at the top of the script in the reverseX thing?
btw, I know that I can use the return or just not use the reverseX thing, but sometimes you just need to use a def also, I know that I can pass the x variable through the call but is there another way?