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  Python code snippet - How to place image in tkinter?

Leave a Reply

Your email address will not be published. Required fields are marked *

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