Functions

Golf Teachers
Mar 27, 2021

There are 2 types of functions. User-defined functions, the functions that you make. Or Pre-defined functions, the functions that Python has already made for you. Let’s first look at a User-defined flowchart.

This flowchart shows how def works. We use def to define a User-defined function. Here we are defining hello(). Inside the def body, it is showing what the function will do. At the end, it is writing hello() so all the statements inside the def body will be executed.

Output: Hello

This is how the flowchart will look in code.

Now let’s look at some Pre-defined functions.

Python Pre-defined functions or Built-in functions are functions that Python has built-in into its code. These functions do not have to be defined because they already are by Python. Some examples are:

len()

type()

list()

str()

id()

And many more.

Bye!

--

--