How To Find Length Of List in Python ?

26-Jun-2021

.

Admin

Hi Guys,

In this blog, I will show you how to get length of array in python. We will learn how to find length of list using python. I would like to share python get length of array example.

This article will give example of how to find total element of array using python. The len() method to return the length of an array using python.

Here i will simple and easy example of how to get length of list in python. So let's see the below example:

Example 1


# Python program to find lenth of list

# of len()

n = len([10, 20, 30,40,50])

print("The length of list is: ", n)

Output:

5

Example 2

# Python program to find lenth of list

# of len()

arrList = []

arrList.append("0")

arrList.append("hi")

arrList.append("orange")

arrList.append("apple")

n = len(arrList)

print("The length of list is: ", n)

Output:

4

It will help you....

#Python