How to check for multiple values in dict in Python
<pre><code>dict1 = {'galaxy': 5, 'apple': 6, 'nokia': 5}
</code></pre>

<p>Is there is a way to show the keys in a dict with the same values in a dict?</p>

<pre><code>target_value = 5
new_dict = {}

for key, value in dict1:
    if value == target_value:
        new_dict[key] = value
</code></pre>

<p>desired output:</p>

<pre><code>dict1 = {'galaxy':5, 'nokia':5}
</code></pre>

<p>If I understand you correctly, you're looking for something like that:</p>

<pre><code>&gt;&gt;&gt; d = {'galaxy': 5, 'apple': 6, 'nokia': 5}
&gt;&gt;&gt; { k:v for k,v in d.items() if v==5 }
{'nokia': 5, 'galaxy': 5}
</code></pre>

python dictionary