Trying to change a variable with a function (integer)

I want to take a variable with an integer assigned to it then call a function that can just simply add to that variable’s number.

This is what I’ve tried:

gold = 0
print(gold)

def addgold(gold):
    gold + 1 = gold

addgold(gold)
print(gold)

Answer

I think you meant to return gold:

gold = 0

print(gold)

def addgold(gold):
    gold = gold + 1
    return gold

gold = addgold(gold)

print(gold)

Also to be clear about functions, their parameters and local variables, this code below is exactly the same as the above:

gold = 0

print(gold)

def addgold(foo):       # parameter is now named foo
    foo = foo + 1
    return foo

gold = addgold(gold)

print(gold)