I am attempting to store multiple function values in an array, in order to graph a function in python.
For the example, let's define that the function is y= x^2 and the argument values wanted are 1,2 and 3. The code I attempted is the following :
def ExampleFunction (x):
return x**2
ArgumentValues=range(3)
FunctionValues=ExampleFunction(ArgumentValues)
Unfortunately running the code results in an error:
TypeError: unsupported operand type(s) for ** or pow(): 'range' and 'int'
How can I return many function values into a string/array in python? As a result I would want the "function values" take the following form:
1,4,9