[Tutor] Why doesn't this work if I make these changes
Diana Furr
dleigh0 at carolina.rr.com
Sun Oct 3 05:20:26 CEST 2004
This program works the way it is now but I was wanting to make a change. When I do change it, it no longer recognizes some things and I was wondering why. Can someone please explain.
This is the program:
def printStatement():
print "\n","Posted Speed Limit: ",limit
print "\n","Clocked Speed: ",clocked
print "\n","Exceeded Speed Limit by: ",speeding
print "\n","Base fine for speeding: ",fine
print "\n","Fine for each mph over speed limit: ",speeding*5
print "\n","Fine for exceeding 90 mph: ",over90
print "\n","Total charges: ",calculatedFine
limit=input("What is the posted speed limit? ")
clocked=input("What was the clocked speed? ")
if clocked<=limit:
print "This driver was not speeding "
elif clocked>90:
speeding=clocked-limit
fine=50
speedingFine=speeding*5
over90=250
calculatedFine=fine+speedingFine+over90
printStatement()
else:
speeding=clocked-limit
fine=50
speedingFine=speeding*5
over90=0
calculatedFine=fine+speedingFine
printStatement()
------------------------------------------------------------------
I want to make this change:
def speedInfo():
limit=input("What is the posted speed limit? ")
clocked=input("What was the clocked speed? ")
if clocked<=limit:
print "This driver was not speeding "
elif clocked>90:
speeding=clocked-limit
fine=50
speedingFine=speeding*5
over90=250
calculatedFine=fine+speedingFine+over90
printStatement()
else:
speeding=clocked-limit
fine=50
speedingFine=speeding*5
over90=0
calculatedFine=fine+speedingFine
printStatement()
speedInfo()
---------------------------------------------------------------------------
Someone has told me that ya'll don't like to help with homework. This already does what the assignment
asks for but I am playing with it trying to learn more. Thank you for your help.
Diana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20041002/40424b94/attachment.html
More information about the Tutor
mailing list