0% found this document useful (0 votes)
7 views1 page

Types of Functions in Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Types of Functions in Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like