Answers for "count a value in a list python"

1

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
8

how to find no of times a elements in list python

thislist = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5)

x = thislist.count(5)

print(x)
Posted by: Guest on May-17-2020
0

Count elements in list Python

List = ["Elephant", "Snake", "Penguin"]

print(len(List))

#	With the 'len' function Python counts the amount of elements 
#	in a list (The length of the list).
Posted by: Guest on May-08-2021

Code answers related to "count a value in a list python"

Python Answers by Framework

Browse Popular Code Answers by Language