Answers for "python dictionary count number of values"

1

python counting dictionary

counts = dict()
for i in items:
  counts[i] = counts.get(i, 0) + 1
Posted by: Guest on October-05-2020
1

get number of key in dictionary python

#Call len(obj) with a dictionary as obj to count the number 
#of key-value pairs in the dictionary.

a_dictionary = {"a": 1, "b": 2}
print(len(a_dictionary))

OUTPUT:
2
Posted by: Guest on October-22-2020

Code answers related to "python dictionary count number of values"

Python Answers by Framework

Browse Popular Code Answers by Language