How to write a function that takes a list of strings and a list of characters as arguments and returns a dictionary whose keys are the characters and whose values are lists of the strings that start with that character.
a_func(['apple','orange','banana','berry','corn'],['A','B','C'])
should give me
{'A':['apple'], 'B':['banana','berry'], 'C':['corn]}
I tried this but not sure how to put if condition in this,
a = ['apple','orange','banana','berry','corn']
b = ['A','B','C']
d = {}
for k,v in zip(b,a):
d.setdefault(k, []).append(v)
print (d)
---------
#output is
{'A': ['apple']}
{'A': ['apple'], 'B': ['orange']}
{'A': ['apple'], 'C': ['banana'], 'B': ['orange']}