Python - Parameters and Arguments
Code Life
By Pierre Marsaa
Parameters vs Arguments
So far, our functions have been simple - they always do exactly the same thing every time we call them. But what if we want a function that can work with different values?
Parameters are how functions ask for information when they're called. Think of them as questions the function needs answered before it can do its job. For example, a greet_codemon() function needs to know which Codémon to greet! Here is an example:
↗️
Loading editor...
↶
↷
As you can see, the function greet_codemon() has a parameter called codemon_name. When we call the function, we provide different values for that parameter: first "Aquachu", then "Pyrochu". The function uses those arguments to customize its behavior.
Verify