Function | Python Fundamental

Fangky Ristiawan
1 min readApr 4, 2021

Previous article :

What is function ?

Functions are blocks of code to carry out an action and will run when the function is called.

Function in Python

The use function in python is very easy, namely by using the “def” keyword followed by the name of the function and (): .

Parameters or Arguments

The parameter term is the information or data that is passed into the function.

From a function’s perspective:

A parameter is the variable listed inside the parentheses in the function definition.

An argument is the value that is sent to the function when it is called.

Call functions, parameters and use arguments

Default parameters

The following example shows how to use a default parameter value.

If we call the function without argument, it uses the default value:

Return

Return is used to return the value when the function is called

--

--

Fangky Ristiawan

About learning all programming languages, for discussion please contact my email : fangkyistiawan@gmail.com