Determine Whether Integer Is Between Two Other Integers? Determine Whether Integer Is Between Two Other Integers? python python

Determine Whether Integer Is Between Two Other Integers?


if 10000 <= number <= 30000:    pass

For details, see the docs.


>>> r = range(1, 4)>>> 1 in rTrue>>> 2 in rTrue>>> 3 in rTrue>>> 4 in rFalse>>> 5 in rFalse>>> 0 in rFalse


Your operator is incorrect. Should be if number >= 10000 and number <= 30000:. Additionally, Python has a shorthand for this sort of thing, if 10000 <= number <= 30000:.


matomo