Pre-recorded question

Question #114
How to count the number of elements in a list in Python?
Answer

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

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

5 events in history
Answer by Alphonsio 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 Alphonsio 06/18/2020 at 06:43:17 PM
How to get the size of a list in Python?
Answer by Alphonsio 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 Alphonsio 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 Alphonsio 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.