Answers for "counting list in python"

2

value count a list python

from collections import Counter
z = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
Counter(z)
>>> Counter({'blue': 3, 'red': 2, 'yellow': 1})
Posted by: Guest on October-26-2021
3

count number items in list python

mylist = ["abc", "def", "ghi", "jkl", "mno", "pqr"]

print(len(mylist))

# output 6
Posted by: Guest on August-03-2020
0

List Count Elements

a = ["more", 4, 6]
print(len(a))
# prints 3
Posted by: Guest on December-10-2021

Code answers related to "counting list in python"

Python Answers by Framework

Browse Popular Code Answers by Language