title: Looping inside a dictionary with multiple keys
body: <p>I'm trying to loop inside a dictionary with three keys and change a category of values (Bmax in this case). The main target is not to change the values of the dictionary itself, instead is to loop through the dictionary and get its values. I need it to formulate an optimization problem afterwards. To do it I'm using "auxiliar dictionaries" (UNITS_DIC and TASKS_DIC). This idea works in a dictionary with two keys. Now I need to extend it for three o more keys.</p>
  
  <pre><code>UNIT_TASKS = {
          ('Heater',    'Heating', 'Pablo')   : {'Bmin': 0, 'Bmax': 100},
          ('Reactor_1', 'Reaction_1', 'Juan'): {'Bmin': 0, 'Bmax':  80}, 
          ('Reactor_1', 'Reaction_2', 'Pedro'): {'Bmin': 0, 'Bmax':  80}, 
          ('Reactor_1', 'Reaction_3', 'Pablo'): {'Bmin': 0, 'Bmax':  80}, 
          ('Reactor_2', 'Reaction_1', 'Pablo'): {'Bmin': 0, 'Bmax':  80},
          ('Reactor_2', 'Reaction_2', 'Juan'): {'Bmin': 0, 'Bmax':  80}, 
          ('Reactor_2', 'Reaction_3', 'Pablo'): {'Bmin': 0, 'Bmax':  80},
          ('Still',     'Separation', 'Pablo'): {'Bmin': 0, 'Bmax': 200}, 
          ('Heater',    'Heating', 'Juan')   : {'Bmin': 0, 'Bmax': 300}, 
          }
  
  TASKS = set([i for (j,i,k) in UNIT_TASKS])
  UNITS = set([j for (j,i,k) in UNIT_TASKS])
  NAMES = set([k for (j,i,k) in UNIT_TASKS])
  
  # Auxiliar dictionaries
  UNITS_DIC = {j: set() for j in UNITS}
  for (j,i,k) in UNIT_TASKS:
      UNITS_DIC[j].add(i)
  
  TASKS_DIC = {i: set() for i in TASKS}
  for (j,i,k) in UNIT_TASKS:
      TASKS_DIC[i].add(k)
  
  
  ####Looping inside Dictionary
  for j in UNITS:
      for i in UNITS_DIC[j]:
          for k in TASKS_DIC[i]:
              UNIT_TASKS[(i,j,k)]['Bmax'] =  2
  
  ####Print Dictionary            
  for key,value in UNIT_TASKS.items():
      print(key,value)
  
  </code></pre>