How to write a function for dictionary from 2 lists in python with if condition?
<p>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.</p>

<pre><code>a_func(['apple','orange','banana','berry','corn'],['A','B','C'])
</code></pre>

<p>should give me</p>

<pre><code>{'A':['apple'], 'B':['banana','berry'], 'C':['corn]}
</code></pre>

<p>I tried this but not sure how to put if condition in this,                                   </p>

<pre><code>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']}
</code></pre>