Google News
logo
Python Program to Get the length of an array
In Python, there is no built-in array data structure like in some other programming languages. Instead, we can use the `list` data structure as an array. To get the length of a list (i.e., the number of elements in the list), we can use the built-in `len()` function.

Here's the Python program to get the length of a list :
Program :
my_list = [1, 2, 3, 4, 5]
print(len(my_list))
Output :
5
In this program, we first define a list `my_list` with 5 elements. We then use the `len()` function to get the length of the list, which is 5.

The `len()` function returns the number of elements in the list as an integer value.