[Tutor] if...elif question
Kalle Svensson
kalle@gnupung.net
Wed, 3 Oct 2001 03:28:33 +0200
Disclaimer: It's late (here), please forgive any spelling errors, coding
mistakes and general weirdness below.
[Chris Keelan]
> I know the answer is staring me right in the face, but why does this little
> code snippet:
>
> ## a function to convert percentages to letter grades
> def grades(percent):
>
> if percent < 60:
> return 'F'
>
> elif percent >= 60 < 70:
This is equivalent with
elif (percent >= 60) and (60 < 70):
elif 60 <= percent < 70:
is probably what you want, this means
elif (60 <= percent) and (percent < 70):
Peace,
Kalle
--
[ Thought control, brought to you by the WIPO! ]
[ http://anti-dmca.org/ http://eurorights.org/ ]