# [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