To find the number of elements in a list, you can use the built-in len() function. Len() function can be used to find the length of objects like string, bytes, tuple, list, etc. Let’s see an example to find the count of elements in a list.
# Finding number of elements in a list
# A list
list_1 = ["a", "b", 1, 2, "e", "f"]
# Use len() to find the number of elements
print( len(list_1) )
Result
6
More tips on lists
Reference
- More about len() function at Python docs.