Skip to content Skip to sidebar Skip to footer

Count Number Of Values In Dictionary For Each Key

I have dictionary data like the following: dict = { 'a' : ('12','3','12'), 'b' : ('32','121'), 'c' : ('232','9','11'), 'd' : ('32'), 'e' : ('243','232') } Is that possibl

Solution 1:

new_dict = {k: len(v) for k,v in dict.items()}

Post a Comment for "Count Number Of Values In Dictionary For Each Key"