title: Performing mathematical operations on values from two dictionaries with same keys in Python
body: <p>I have two dictionaries named as, lets say, <code>a = {'A':{2021:45.65},'B':{2021:56.34}}</code> and <code>b = {'A':{2021:78.67},'B':{2021:87.54}}</code></p>
  <p>I want to get the values from both A and B 'sub-dictionaries' and compute what percentage of value from the second dictionary is the value from the first dictionary.</p>
  <p>I can't seem to figure out a way how to access both the float values from different dictionaries and compute the result.</p>
  <p>--------------------------<strong>UPDATE</strong>------------------------</p>
  <p>Apologies about not comprehending my problem in a proper manner. I figured out a way to do that and if you think it has an issue still please do mention.</p>
  <pre><code>dict_keys = ['A','B']
  for x in dict_keys:
     val1 = a[x].values()
     val2 = b[x].values()
  </code></pre>