Check if a given value is out of certain range
alister.nospam.ware at ntlworld.com
Wed Sep 30 11:41:51 CEST 2015
On Tue, 29 Sep 2015 18:44:33 -0500, Tim Chase wrote:
> On 2015-09-29 21:32, Mark Lawrence wrote:
>> On 29/09/2015 17:48, Rob Gaddi wrote:
>> >> Is there any similar elegant way to check if a value is out of
>> >> certain range?
>> >> Example - To check if x is either less than zero or greater than
>> >> ten? Right now I am using x < 0 or x > 10.
>> > not (0 <= x <= 10)
> Not sure there's much "yuck" to be had there. It's succinct, easy to
> read, and correct. The only improvement might be if you have things to
> do in both cases, in which case remove the "not" and set the clauses
> if 0 <= x <= 10:
I would stick with the OP's current solution
BUFFERS=20 FILES=15 2nd down, 4th quarter, 5 yards to go!
More information about the Python-list