title: Compare two values in dictionarys python
body: <p>Pretty new to the python language and ran in to a problem.
  Is it possible to compare values in dictionaries?</p>
  <p>I've made two api calls and need to check if the id:s are same and then return all deals</p>
  <p>My code:</p>
  <pre><code>    company_response = get_api_data(headers=headers, url=url)
  
      
      company_deals = get_api_data(headers=headers, url=url)
  
      
  
      myDealsDict = {}
      companyDict = {}
  </code></pre>
  <pre><code>if len(company_response and company_deals) &gt; 0:
          
          for company in company_response:
              companyDict[company['_id']] = company
  
          for deal in company_deals:
              try:
                  myDealsDict[deal['company']]['deals'].append(deal)
              except KeyError:
                  myDealsDict[deal['company']] = {
                      'company_name': companyDict[deal['company']],
                      'deals': [deal]
                  }
  
          return render_template(&quot;api.html&quot;, allDeals=myDealsDict)
  </code></pre>
  <p>allDeals only return the id:s of the companies now..</p>
  <p>EDIT Sample:</p>
  <pre><code>Companies
      &quot;id&quot;: 0,
      &quot;name&quot;: &quot;string&quot;,
      &quot;phone&quot;: &quot;string&quot;,
      &quot;www&quot;: &quot;string&quot;,
      &quot;postaladdress1&quot;: &quot;string&quot;,
      &quot;visitingaddress1&quot;: &quot;string&quot;,
      &quot;postaladdress2&quot;: &quot;string&quot;,
      &quot;visitingaddress2&quot;: &quot;string&quot;,
      &quot;postalzipcode&quot;: &quot;string&quot;,
      &quot;postalcity&quot;: &quot;string&quot;,
      &quot;visitingzipcode&quot;: &quot;string&quot;,
      &quot;visitingcity&quot;: &quot;string&quot;,
      &quot;country&quot;: &quot;string&quot;,
      &quot;fullpostaladdress&quot;: &quot;string&quot;,
      &quot;fullvisitingaddress&quot;: &quot;string&quot;,
      &quot;debitorno&quot;: 0,
      &quot;inactive&quot;: true,
      &quot;prisfil&quot;: true,
      &quot;registrationno&quot;: &quot;string&quot;,
      &quot;coworker&quot;: 0,
  
  Deals:
       [
    {
      &quot;id&quot;: 0,
      &quot;name&quot;: &quot;string&quot;,
      &quot;company&quot;: 0,
      &quot;person&quot;: 0,
      &quot;coworker&quot;: 0,
      &quot;dealstatus&quot;: {
        &quot;id&quot;: 0,
        &quot;key&quot;: &quot;contact&quot;,
        &quot;text&quot;: &quot;string&quot;
      },
      &quot;value&quot;: &quot;string&quot;,
      &quot;probability&quot;: &quot;string&quot;,
      &quot;weightedvalue&quot;: &quot;string&quot;,
      &quot;wonlostreason&quot;: &quot;string&quot;,
      &quot;quotesent&quot;: &quot;2022-03-21&quot;,
      &quot;expecteddate&quot;: &quot;string&quot;,
      &quot;closeddate&quot;: &quot;2022-03-21&quot;,
      &quot;todo2&quot;: 0
    }
  ]
  
  </code></pre>
  <p>Need to compare the company value in deals with company id.</p>