I'm trying to make a function that adds 1 everytime when called. For example, the output of this code is would be 3, but it returns 1.
def count():
count = 0
count += 1
return count
count()
count()
count()
print(count())
I'm trying to make a function that adds 1 everytime when called. For example, the output of this code is would be 3, but it returns 1.
def count():
count = 0
count += 1
return count
count()
count()
count()
print(count())