Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a variable and a parameter

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?


1 Answers

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 ...)
like image 106
ShadowRanger Avatar answered Aug 27 '26 14:08

ShadowRanger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!