basic if stuff- testing ranges

Mel mwilson at the-wire.com
Sun Nov 25 19:54:16 CET 2007


Donn Ingle wrote:
> Sheesh, I've been going spare trying to find how to do this short-hand:
> if 0 > x < 20: print "within"
> 
> So that x must be > 0 and < 20.
> 
> I usually do:
> if x > 0 and x < 20: print "within"
> 
> What's the rule? Does it even exist?

if 0 < x < 20:
     ?


	Mel.



More information about the Python-list mailing list