[Tutor] if...elif question

alan.gauld@bt.com alan.gauld@bt.com
Wed, 3 Oct 2001 22:34:52 +0100


>     elif 60 <= percent < 70:
> 
> "If the percent is between the range of 60 and 70...".  Another way to
> write this is:
> 
>     elif percent >= 60 and percent < 70:
> 

Wow! Just when I think I'm getting to know Python something new bites me.
I never knew Python could do comparisons like that - in fact I don't 
think I know of any other programming language I've used that did it... 
OTOH that may be because I always parenthesize comparisons from years 
of being bitten by C...

Once again in penance I cite the doc page reference:

$PYTHON/Doc/ref/comparisons.html

What a language :-)

Alan g