I'm trying to improve my coding by using dictionaries.
I have one with inputs and one with outputs. The problem is that is seems like I can't reference to a dictionary inside said dictionary.
def calculate(x,y):
return x + y
inputs = dict(
a = 1,
b = 2,
c = 3,
)
outputs = dict(
d = calculate(inputs['a'], inputs['b']),
e = calculate(inputs['a'], outputs['d']),
)
e
is creating trouble.NameError: name 'outputs' is not defined
Should I use self of some sorts here?
Bonus question:
I have about 30 inputs, and 20 output calculations. Do you recommend another way of solving this than the way I have?