[Tutor] Why doesn't this work if I make these changes
Bill Mill
bill.mill at gmail.com
Sun Oct 3 05:30:20 CEST 2004
Diana,
what error does the second program give you? Does it have a semantic
error (i.e. not work like you think it should)? Try to make it easy
for us to answer your questions, and it'll be easier to help you.
Peace
Bill Mill
----- Original Message -----
From: Diana Furr <dleigh0 at carolina.rr.com>
Date: Sat, 2 Oct 2004 23:20:26 -0400
Subject: [Tutor] Why doesn't this work if I make these changes
To: tutor at python.org
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
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list