i have a list of list with only strings and i have to create a dictionary with strinds as keys and their count in list of list as value. should look like this:
[[‘dolphin’, ‘bomb’, ‘spider’], [‘eye’, ‘bomb’, ‘fire’],
[‘spider’, ‘fire’, ‘lock’], [‘bomb’, ‘lock’, ‘tree’]]
and the output should be with every key in different line :
dolphin 1
bomb 3
spider 2
eye 1
fire 2
lock 2
tree 1
this is my code:
dic_count={}
count=1
def print_symbols_counts(deck):
for i in range(len(deck)-1):
for j in deck[i]:
if j in deck[i+1]:
dic_count[j]=count+1
else:
dic_count[j]=count
return dic_count
but sudly i cant get the correct output (this is my output):
{'dolphin': 1, 'bomb': 1, 'spider': 1, 'eye': 1, 'fire': 1, 'lock': 2}
thank you:)