I am trying to write a script to count the occurrences of an item in a MULTIDIMENSIONAL list. For example it would return:
Happy: 1 Giggly: 3 Hazy: 1
data = {"AK-47":["Happy","Giggly","Confident"],
"Gelato":["Slumped","Tired","Light","Giggly"],
"Buddah Bliss":["Confused","Euphoria","Hazy"],
"Grandaddy Purple":["Sleepy","Slumped"],
"Laughing Gas":["Giggly","Light","Euphoria"]}
def countX(lst, x):
count = 0
for ele in lst:
if (ele == x):
count = count + 1
return count
for key,values in data.items():
if key == str:
print (key)
print ('\n'+key)
for i in values:
print("-",i)