[Tutor] if-elif-else statements

Akbar Pasha akbarpasha at gmail.com
Fri Oct 14 02:07:25 CEST 2005


I think you should check the if conditions with "clocked" not speedlimit
which is the differential.

::akbar

On 10/13/05, andrade1 at umbc.edu <andrade1 at umbc.edu> wrote:
>
> amount is supposed to equal fine because there are a couple of different
> fines. there is a fine for going over 90mph that includes a penalty and
> then
> there is a fine for just going over the speed limit as long as it is under
> 90.
>
>
> > Is amount suppose to equal total instead of fine?
> >
> >
> >
> > On Thursday 13 October 2005 04:58 pm, andrade1 at umbc.edu wrote:
> >> def main():
> >> actual = input("Please enter the legal speed limit: ")
> >> clocked = input("Please enter the clocked speed limit: ")
> >> speedlimit = clocked - actual
> >>
> >> fine = 50 + 5*speedlimit
> >> total = 200 + fine
> >> amount = fine
> >>
> >> if speedlimit < 90:
> >> print "The total amount due is", amount
> >>
> >> elif speedlimit >= 90:
> >> print "The total amount due is", total
> >>
> >> else:
> >> print "The speed was legal."
> >>
> >>
> >> main()
> >
> >
> >
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051013/ddb13ff0/attachment.html


More information about the Tutor mailing list