Using not to Determine Range
And writing a condition to see if a number is inside a range is pretty straightforward. You usually use a compound inequality using the word
and. To be in the range
40, including the end point of
20, a number has to be at least
20 and at the same time, less than
If you say
not followed by the previous condition, this will now be
True when a number is outside of that range. Remember you want to do the
and first, so that part of the condition has to be put in parentheses.
Become a Member to join the conversation.