Question #90   Submitted by Answiki on 06/18/2020 at 06:31:42 PM UTC

How to count the number of elements in a list in Python?

Answer   Submitted by Answiki on 09/06/2020 at 07:02:16 AM UTC

The Python len() function returns the size of a list (count the number of elements):

>>> myList=[8, 2, 3, 6, 8]
>>> len(myList)
5

6 events in history
Question by Answiki 07/24/2022 at 08:38:49 AM
How to count the number of elements in a list in Python ?
Answer by Answiki on 09/06/2020 at 07:02:16 AM

The Python len() function returns the size of a list (count the number of elements):

>>> myList=[8, 2, 3, 6, 8]
>>> len(myList)
5

Question by Answiki 06/18/2020 at 06:43:17 PM
How to get the size of a list in Python?
Answer by Answiki on 06/18/2020 at 06:40:54 PM

The Python len() function return the size of a list (count the number of elements):

>>> myList=[8, 2, 3, 6, 8]
>>> len(myList)
5

Answer by Answiki on 06/18/2020 at 06:32:38 PM

To count the number of elements in a list in Python, use the len() function:


>>> myList=[8, 2, 3, 6, 8]
>>> len(myList)
5

Question by Answiki 06/18/2020 at 06:31:42 PM
How to count the number of elements in a list in Python?
# ID Query URL Count

Icons proudly provided by Friconix.