Check if a given value is out of certain range

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Oct 5 05:19:56 EDT 2015


On 05/10/2015 09:18, Michiel Overtoom wrote:
>> Why not use a function?
>>> if outside(x, 0, 10):
> print("x has wrong value")
> else:
> print("x has good value")
>>> where 'outside' is defined as:
>> def outside(value, lowerbound, upperbound):
> return value < lowerbound or value > upperbound
>> Greetings,
>
Please wash your mouth out with soap, burn precious clock cycles just to 
make code readable, never I say :)
-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /