CS 170 Lab 4: Been caught speeding. . .

This is a lab exercise that has you using if statements to figure out speeding ticket costs.

  1. Save the file speed.py to your CS 170 directory.

  2. Launch Idle and use Open to begin editing this file. This program uses if statements and a for loop to do calculations about speeding ticket costs.

    The speeding ticket fine policy in Truville is that each speeding ticket is $50 plus $5 for each mph over the limit, plus a penalty of $200 for any speed over 90 mph. Write a main program that asks the user how many tickets they have, then for each ticket asks for the speed limit and clocked speed. You should calculate and print the fine for each ticket and return the sum total of all the fines. Report a fine of $0 for a ticket if the clocked speed was not over the limit.

    Use variables as you deem appropriate. Be sure to comment your code appropriately, explaining how it works and commenting the important steps in your main program. You are not required to use separate functions for this program, but you are welcome to if you would like to.

  3. When your program is working properly upload your Python file, choosing Lab 4 as the assignment you are submitting.