basic if stuff- testing ranges

Donn Ingle donn.ingle at gmail.com
Mon Nov 26 04:49:58 CET 2007


>> if 0 > x < 20: print "within"
> That means "if x LESS THAN 0 and x < 20".
Oh, bugger. It's tricky. 
> So try
>     if 0 < x < 20:
Thanks. I was flipping signs in my tests, but I guess I flipped both and got
myself all confused.
 
> Likely manuals: Tutorial & Reference
> Tutorial: check contents, "if statement" looks possible, but no luck
Yes, I got that far.
> Reference: check contents, "comparisons" looks possible, and
Thanks again. I find the reference is laid-out in a way that I don't find
intuitive and every time I look for something I fail. I even grep through
the folder to get a clue, which shows how poor the index is (to me)!
 
Many thanks for the help!
\d




More information about the Python-list mailing list