Menu Close

Python len () Function

Here we are going to learn all about the Python len() function to get the length of the python object.len function in python is mostly used by python programmers.

In previous tutorials, we have seen the python iter() function to returns the iterator object.

Python len function

Python len function is a built-in function in python that is used to find the length of the python object.


The syntax of len function in python is:-



len function in python accepts one parameter that will be python object.

Return Value

Return value of len function in python is length of the python object.

Python len example

Here we will take an example to understand the python len() function.


#length of the string
print(len('Programming Funda'))

#length of the list
print(len([1, 2, 3, 4, 5, 6, 7, 8]))

#length of the set
print(len({'Python', 'Java', 'C++', 'C', 'PHP'}))

#length of the tuple
print(len((1, 2, 3, 4)))




In this article, you have learned all about the python len() function to get the length of the python object.
This function will helpful for you in the future. If you like this article, please share and keep visiting for further python built-in functions tutorials.

Python built-in functions

For more information:- Click Here

Python iter() Function
Python map() Function

Was this post helpful?

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *