Python count items in the list

In this tutorial, we will see how to count items inlist in python


Count total items in the list

You can use len() function to count items in the list.

Let’s understand with the help of example.

πŸ’» Awesome Tech Resources:
  • Looking for βš’οΈ tech jobs? Go to our job portal.
  • Looking for tech events? Go to tech events πŸ—“οΈ Calendar.️

Output:

List: [1, 2, 3, 4] Length of list1: 4

Count occurence of each element in the list

Output:

List: [1, 2, 3, 4, 1, 4, 3, 2, 2, 1, 5] Count of 2 in list1 3

That’s all about Python count items in the list.

Related Posts

Leave a Reply

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

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.