How to get the number of elements in a list - Length of a list in python

Using len() function, we can find the length of a list.

Example

len(list_name)



Printing the list elements

Example

#list length in python

number = [1, 2, 3, 4, 5]
print("Length of the 'number' list ", len(number) )

odd    = [1, 3, 5]
print("Length of the 'odd' list ", len(odd) )

even = [2, 4]
print("Length of the 'even' list ", len(even) )


Topics You Might Like