How to pass dictionary as an argument of function and how to access them in the function
<p>I tried doing this:</p>

<pre><code>def func(dict):
    if dict[a] == dict[b]:
        dict[c] = dict[a]
    return dict

num =  { "a": 1, "b": 2, "c": 2}
print(func(**num))
</code></pre>

<p>But it gives in TypeError.
Func got an unexpected argument a</p>

<p>Using ** will unpack the dictionary, in your case you should just pass a reference to <code>num</code> to func, i.e.</p>

<p><code>print(num(func))</code></p>

<p>(Unpacking <code>**</code> is the equivalent of <code>func(a=1,b=2,c=3)</code>), e.g.</p>

<pre><code>def func(arg1,arg2):
    return arg1 + arg2

args = {"arg1":3,"arg2":4}
print(func(**args))
</code></pre>

python python-3.x