Turn this:
a = {'1': {'name': 'Blue', 'qty': '1'},
'2': {'name': 'Green', 'qty': '1'},
'3': {'name': 'Blue', 'qty': '1'},
'4': {'name': 'Blue', 'qty': '1'}}
into this:
b = {'1': {'name': 'Blue', 'qty': '3'},
'2': {'name': 'Green', 'qty': '1'}}
I was able to exclude the repeated values but could't increment the 'qty' field.
b = {}
for k,v in a.iteritems():
if v not in b.values():
b[k] = v