Return if a number is between two values [Python] -



Return if a number is between two values [Python] -

quite simple question, have no clue on how implement this.

essentially:

>>> r = range(4,-1) >>> 3 in r false >>> q = range(-1,4) >>> 3 in q true

as can see, have same bounds, -1 , 4, , same test value, how '3' between'-1' , '4' when not know order given me in?

why not sort bounds first?

r = range(*sorted((4, -1))) q = range(*sorted((-1, 4)))

python python-3.x

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -