Python list length – using len() method to return length of list

Python list length method

Python gives len() method to know the total number of elements in a given list. The len() method takes an argument (list_name) and returns total elements in that list.

Syntax of len()

len(list_name)

Example of using length method

In this example a list with three elements is created and by using len() method we will display total number of elements in  that list:

Output of this would be:

length of list =  3


Was this article helpful?

Related Articles

Leave A Comment?