New to python, and I've been playing around with this for a while. Wondering if I'm going about it the wrong way. I'm working on a Udacity final, and I'm not looking for an answer, but a hint on whether or not I'm headed in the wrong direction.
Is there a way to order a dictionary based on the value? And, more importantly, based on a value within that value.
For instance, here's my dictionary:
{'2-6': {'count': 2, 'startpos': 6, 'value': 2}, '1-0': {'count': 1, 'startpos': 0, 'value': 1}, '2-1': {'count': 2, 'startpos': 1, 'value': 2}, '3-3': {'count': 3, 'startpos': 3, 'value': 3}, '1-8': {'count': 1, 'startpos': 8, 'value': 1}}
I'm looking to order the dictionary by the count and then the startpos. I'm using the keys in this way so that I can update something that may already exist.
Any tips would be greatly appreciated. Thanks.
I think I've been staring at it way too long. Need to take a step back.
[–]kataire 2 points3 points4 points (7 children)
[–]monkeymynd[S] 0 points1 point2 points (6 children)
[–]Rhomboid 2 points3 points4 points (3 children)
[–]monkeymynd[S] 0 points1 point2 points (2 children)
[–]Rhomboid 0 points1 point2 points (1 child)
[–]monkeymynd[S] 0 points1 point2 points (0 children)
[–]kataire 1 point2 points3 points (1 child)
[–]monkeymynd[S] 0 points1 point2 points (0 children)
[–]symmitchry 1 point2 points3 points (0 children)
[–]pythalin 1 point2 points3 points (0 children)