How to get the number of elements in a list in Python?
In thisĀ tutorial, you will learn how to get the number of elements in a list in Python?
In python, we have inbuilt function to calculate length of list , i.e len(). We will use that function.
#python code:
list_names = ['ravi', 'rakesh', 'david']
list_ids = [10,15,25,25]
print(len(list_names))
print(len(list_ids))
Output:
3 4
If you have any alternative methods or procedures for same requirement, you can comment below.