How to Find Size of List Items or Get Length in Python

In this tutorial, learn how to find size of list item using Python. The short answer is: Use the Python len() function to get the length of list items. The elements of the list variable are the items enclosed within the single or double-quotes.

A list variable may contain elements same as the element we find in an array in other programming languages like Java. You may also like to read how to create variables in Python to create other types of variables.

How to Find Size of List Items in python

To find the length of the list variable in Python, you have to use the len() function. Inside the function, you have to pass the list variable as the argument of it.

Now, if you print the combination as given in the example below. You will get the exact number of the list items available in the list variable. It counts the string as well as the integer and float items of the list variable of Python.

Output

6

The above example gives 6 as the output of the len() function. There are six elements inside the list variable. However, you can add more items to the list in Python. After that, you have to use the Python print statement to find the size of the list items and print the length in the output.

You may also like to read

I hope you like this tutorial on how to get the length and find the size of list items in Python.

References