Home How to get the number of elements in a list in Python?

# How to get the number of elements in a list in Python?

user5916
1#
user5916 Published in September 19, 2018, 11:03 am
items = []
items.append("apple")
items.append("orange")
items.append("banana")

# FAKE METHOD::
items.amount()  # Should return 3


How do I get the number of elements in the list?

• You are obviously asking for the number of elements in the list. If a searcher comes here looking for the size of the object in memory, this is the actual question & answers they are looking for: How do I determine the size of an object in Python? – Aaron Hall Oct 31 '16 at 14:37