Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. Functions in python
  5. Calling a function

Calling a function

A function is a block code that takes in some data and, either performs some kind of transformation and returns the transformed data, or performs some task on the data, or both.

Note that the function block is intended by four spaces.

To call a function means that we are telling the program to execute the function. If there is a return value defined, the function would return the value, else the function would return none.

To call the function, we write the name of the function followed by parentheses.


def function_name():
    body of function


def my_function():
    print("How are you?")
How are you?

This is how we can call function in python.

Was this article helpful to you? Yes No

How can we help?