Input : a = [1, 2, 3, 1, 2, 3] Output : 6 Count the number of entries in the list a. Input : a =  Output : 0
The idea is to use len() in Python
The length of list is: 4
The length of list is: 3
How does len() work?
len() works in O(1) time as list is an object and has a member to store its size. Below is description of len() from Python docs.
Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set).
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Find the size of a list - Python
- PyQt5 - How to adjust size of ComboBox according to the items size
- Python | Convert list of string to list of list
- Python | Convert list of tuples to list of list
- Python | Convert List of String List to String List
- Break a list into chunks of size N in Python
- Python | Combinations of elements till size N in list
- Python | Subgroups of i'th index size in list
- Python | Sort list of lists by the size of sublists
- Python | Categorize the given list by string size
- Python | Increase list size by padding each element by N
- Python | Size Range Combinations in list
- Python | Size and element exponentiation of list
- Python - Fill Strings for size K in Tuple List
- Python - List of N size increasing lists
- Python | Find maximum length sub-list in a nested list
- Reverse a singly Linked List in groups of given size | Set 3
- PyQt5 Combo Box – List View part with different border size(thickness)
- PyQt5 Combo Box – Different border size to list view when mouse hover over it
- Python Counter to find the size of largest subset of anagram words
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.