Python List len() Method
The len() method returns the number of elements in the list.
Python List len() Syntax
Syntax of the len() method.
len(list)
Python List len() Parameters
- list : The list to count the number of elements.
Python List len() Return Value
Return the number of list elements.
Python List len() Example#1
The following example demonstrates the use of the len() function.
#!/usr/bin/python3
list1 = ['deepinout', 'Apidemos', 'com']
print (len(list1))
list2=list(range(5)) # Create a list of 0-4
print (len(list2))
Output: