What is list size in python
List size doesn’t always mean the number of items in a list. The set size is a technique for counting the number of unique values in a set or list. What does this have to do with writing? Well, you might want to make your posts more informative by using lists. You can use the length method that we learned about earlier , but we can do more with lists. If you have lists of objects, you can use the sum method. This will add up the values of a list. Finally, you might want to know how many unique items are in a list
Introduction
In this tutorial, we are going to learn more about lists and summing up the numbers of singulars in lists. We will look at how one can create a list with unknown values, how to count the items in a list that have been given by an array and also what happens when you use sum(list) method on empty lists.
The code for this article is here
##List size in python: what is list size in python?

How to find the size of a list in python
Like the length method, sum() takes a list as an argument. It returns how many unique values are in your list. This is useful for setting the size of a list in Python, but we’ll be counting all of those unique objects in our objects. For example, [1] , [2] , gives us 4 items: 1 and 2 are not repeated values like 0 and 1 ; they’re different lists. (That’s why 1 and 2 are in different boxes.) You can use the sum(list) method to count how many unique values are in a list. Here’s some code listing:
>>> myList = [3, 2, 4]
>>> myList.sum()
6
Not very interesting! We can do better with list comprehension: what’s the count how [3, 2, 4] (or any other list). The function makes it easy to count things:
>>> myList.sum(lambda x: x.count(2))
2
Yeah, that’s about as good as it’s going to get for counting things. But wait, there’s an improvement! The sum() function creates a list and adds up the values of each item in our list individually. We don’t need an extra list added to our function, we just want a count of how the original lists are. We can do this with map() :
>>> myList.sum(lambda x: x.count(2))
2
That’s better! We know how to check the size of a list in Python, now let’s make our code more beautiful by adding decorators and classes. Let’s create our own class called Size :
