Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

Look at the below code:

items = []

items.append("apple")

items.append("orange")

items.append("banana")

# FAKE METHOD:

items.amount()  # Should return 3

I don't know how to get the number of elements which is present in the list items?

1 Answer

0 votes
by (26.4k points)

The len() function can be utilized with a few unique sorts in Python - both built-in  and library types

>>> len([1,2,3])

3

Click here, for Official 2.x documentation

Click here, for Official 3.x documentation

Want to learn python to get expertise in the concepts of python? Join python certification course and get certified

Related questions

+1 vote
2 answers
0 votes
1 answer
0 votes
2 answers
asked Oct 3, 2019 in Python by Tech4ever (20.3k points)
0 votes
1 answer
asked Oct 14, 2019 in Python by Sammy (47.6k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...