Types of Functions in Python
In Python, there are two main types of functions:
1. Built-in Functions
These are functions already provided by Python. You can use them directly without defining
them.
Examples:
print('Hello') # prints output
len([1, 2, 3]) # gives length
max(10, 20) # gives maximum
type('abc') # gives data type
2. User-defined Functions
These are functions created by the programmer using the 'def' keyword.
Example:
def greet(name):
return f'Hello, {name}!'
print(greet('Alice')) # Output: Hello, Alice!
Memory Tip
Built-in = Ready-made, User-defined = Home-made