Skip to content

Python code snippet – How to count all elements in a list?

List = ["Elephant", "Snake", "Penguin"]

print(len(List))

#	With the 'len' function Python counts the amount of elements 
#	in a list (The length of the list).
#	In this case the output is '3' because there are 3 elements in the list. 
See also  How to declare a interface in Java?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.