I would like to define my function f(x,a) in which the value of 'a' changes, so that every time I call f(x,a), the value of 'a' will be different. So far the following code serve the purpose:
a=0
def f(x):
global a
a=a+1
return a+x**2
In this case, everytime f(x) is called, the value of a is changed as well. I am wondering if there are any other ways to realize the results? Thank you.