I am working in a domain in which ranges are conventionally described inclusively. I have human-readable descriptions such as from A to B , which represent rang
I am not sure if this is already covered, this is how I handled it to check if my variable is within a defined range:
my var=10 # want to check if it is in range(0,10) as inclusive
limits = range(0,10)
limits.append(limits[-1]+1)
if(my_var in limits):
print("In Limit")
else:
print("Out of Limit")
This code will return "In Limit" since I have expanded my range by 1 hence making it inclusive