I am learning python 3 and programming in general for the first time, but I can't seem to distinguish a parameter and a variable?
A parameter is a variable that was received as an argument to a function. Once the function has begun executing, the parameter is just like any other variable; it can be reassigned (and stops being tied to the caller's argument) like anything else.
global_variable = ... still a variable, just defined globally ...
def foo(parameter):
function_local_variable = ... something defined locally ...
foo(... argument that is bound to parameter in foo ...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With