Argument
Python arguments and their usage
Python Argument refers to information that you pass into a function. A function can have 0, set amount, or infinite arguments passed to it. Weβll run through an example of each below.
Note: You may hear the word parameter
get used. This is the same as argument and two can be used interchangeably.
Another interesting aspect of function arguments is that they can have a default value. This means if you do not specify them when you call a function, then their default value will be used.
In fact, I bet you use more python argument defaults than you do specified arguments.
You can name arguments whatever you want! Just be careful that you arenβt using a word that is already in the python namespace. You may get unintended results. Some of these are print
, abs
, for
, while
, etc.
Arguments are extremely common throughout the Python language and its libraries. In fact, itβs extremely popular as a part of fundamental coding languages in general.
Letβs take a look at a python argument code sample.