How to get the number of elements in a list in python?

Spread the love

Problem –

You want to know how many items in a list in python.

Solution –

To get the number of elements in a list in python, you can use the built-in len() function.

In [1]: lst = [5, 10, 15, 20, 25]

In [2]: len(lst)
Out[2]: 5

Rating: 1 out of 5.

Leave a Reply