if I have a dictionary like this
>>> d = {10: 3, 100: 2, 1000: 1}
I can type something like:
>>> d.get(10), d.get(100), d.get(1000)
(3, 2, 1)
Though I want that if the given key is not found, the value corresponding to the nearest key respect the given key is returned:
>>> d.get(20), d.get(60), d.get(200)
(3, 2, 2)
Instead the result in Python is
(None, None, None)
What's a Pythonic way to implement the behavior I described?
Thanks