[Tutor] if...elif question

Ignacio Vazquez-Abrams ignacio@openservices.net
Tue, 2 Oct 2001 21:39:05 -0400 (EDT)


On Wed, 3 Oct 2001, Kalle Svensson wrote:

> [Ignacio Vazquez-Abrams]
> > On Tue, 2 Oct 2001, Chris Keelan wrote:
> > >     elif percent >= 60 < 70:
> > It should read "elif percent>=60 and percent<70:". As you have it, it
> > evaluates "percent>=60" and then compares that against 70. Since the result
> > of the first is always less than 70 (either 0 or 1), it is always true.
>
> It does?  I thought python special-cased here and evaluated it as
> ((percent >= 60) and (60 < 70))

Huh. So it does. My mistake.

-- 
Ignacio Vazquez-Abrams  <ignacio@openservices.net>