Lets say I have the following dictionary;
d = {'a': 5,
'b': 10,
'c': 15,
'd': 20}
Now I want to find out between which values a certain variable is and return the uppermost corresponding key. So for example for var = 8, I would like to return b. And for var = 10, I also would like to return b.
Because I'm using this in larger loop I would like to this as efficient as possible and that is why I came to StackOverflow