I have a dictionary:
d = {'a':[1,3], 'b':[3,4,5,6], 'c':[1], 'd':[1,2,3] }
I want to make a smaller, new dictionary with the top two key:value pairs, sorted by the len
of the lists in value. So in this case, I want:
newd = {'b':[3,4,5,6], 'd':[1,2,3] }
I tried this answer but got this error:
NameError: global name 'd' is not defined