I seem to be somehow screwing up the most basic thing. I have:
def function(a, b, c):
return 'hi'
print(function(a,b,c)) results in a NameError for every variable.
What is the cause of this?
The names of the arguments of a function are local variables, they are not available as global names. a, b and c exist only inside of the function, and receive the values you pass to the function.
You need to create new variables or use literal values when calling the function:
print(function(1, 2, 3))
would work because 1, 2 and 3 are actual values to pass into the function.