
Here, we have created a function named greet().
return (optional) - returns value from a function. arguments - any value passed to function. function_name - any name given to the function. def - keyword used to declare a function. The syntax to declare a function is: def function_name(arguments): User-defined functions - We can create our own functions based on our requirements. Standard library functions - These are built-in functions in Python that are available to use.
There are two types of function in Python programming:
You can create two functions to solve this problem:ĭividing a complex problem into smaller chunks makes our program easy to understand and reuse. Suppose, you need to create a program to create a circle and color it. A function is a block of code that performs a specific task.