python dictionary key in range code example
Example: python dictionary key in range
myDict = {
(float('-inf'), 12): "child",
(13, 19): "teen",
(20, 65): "adult",
(66, float("inf")): "senior"
}
testValue = 10
for (k1, k2) in myDict:
if (k1 < testValue and k2 > testValue):
result = myDict[(k1,k2)]