[Tutor] "And" function
geon
geon at post.cz
Tue Jul 5 10:21:35 CEST 2005
gordnjen napsal(a):
> I need to write a program that will do the following:
>
> Ask the user's age.
> If their age is below 1 yr old, it prints "you are old enought to eat
> baby food"
> If they are over 16, it prints "You are old enough to drive"
> If they are over 65, it prints "You are old enough to drive" and "You
> are old enough to retire"
>
> If they are between the ages of 16 and 25, it prints "you are old
> enough to get a student discount".
>
> So far, I have this:
what about this:
>
> age =input("How old are you?")
> if age>16:
> print "You are old enough to drive!"
> if age>65:
> print "You are old enough to retire!"
> if age<1:
> print "You are old enough to eat baby food!"
>
>
If's those are on the same logical level should be also on the same
vertical level :-)
Pavel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050705/1852ec04/attachment.htm
More information about the Tutor
mailing list