I'm new to Python. When I try to run the following program with
a3=DictAdder()
a3.add({1:1},{2:2}}
I get the "iteration over non-sequence" error.
class DictAdder:
def add(self, x, y):
dict={}
for k in x.keys(): dict[k]=x[k]
for k in y.keys(): dict[k]=y[k]
return dict
does anyone know what's wrong with the code? or I need to import some libraries? Thanks!