84.9k views
2 votes
The speeding ticket fine policy in Podunksville is $50 plus $5 for each mph over the limit plus a penalty of $200 for any speed over 90 mph. Write a program that accepts a speed limit and a clocked speed and either prints a message indicating the speed was legal or prints the amount of the fine, if the speed is illegal.

1 Answer

3 votes

Answer:

Check the explanation

Step-by-step explanation:

here is the complete python code as per the requirement.

=========================================================

#ask to input speed limit

speed_limit = int(input("Enter the speed limit: "))

#if speed limit is less than 90

if speed_limit <=90:

print("Speed is legal.")

#else calculate the fine

else:

fine = 50 + 5 * (speed_limit - 90) + 200

#display the fine

print("fine amount is: $", fine, sep='')

=========================================================

Kindly check the code screenshot and code output in the attached images below.

The speeding ticket fine policy in Podunksville is $50 plus $5 for each mph over the-example-1
The speeding ticket fine policy in Podunksville is $50 plus $5 for each mph over the-example-2
User Zerocool
by
5.1k points