I have been set a task to make a fruit machine game in python, however I am facing a small problem, it involves a variable. it is saying that I have referenced the variable before it's assignment, even though I have assigned it. It seems to be reading it as a local variable instead of a global variable. How do i fix this.
This is the part causing the most trouble
Credit = 1
def main(): #the main program
Credit = Credit - 0.20
print("Credit remaining = " + Credit) #tells the player the amount of credit remaining
print("\n *** The Wheel Spins... *** \n") #Spinning the wheel
print(input("\n (press enter to continue) \n"))
error message
line 19, in main
Credit = Credit - 0.20
UnboundLocalError: local variable 'Credit' referenced before assignment