M
Markus Franz
Hi!
I have:
x = {'a':3, 'b':2, 'c':4}
How can I sort x by value? (I tried using sorted() with x.items() - but I
didn't get a dictionary as response.)
My second question:
How can I reduce the dictionary to 2 items (so delete everything after the
first two items)
Thanks in advance.
Best regards,
Markus
I have:
x = {'a':3, 'b':2, 'c':4}
How can I sort x by value? (I tried using sorted() with x.items() - but I
didn't get a dictionary as response.)
My second question:
How can I reduce the dictionary to 2 items (so delete everything after the
first two items)
Thanks in advance.
Best regards,
Markus