A function is the same as it is in other classes. It is a block of code that is executed only when it is called. def keyword is used to define a function in python.
Example:
def func():
printf("Welcome to TutorialsLink");
func()
OUTPUT: Welcome to TutorialsLink