Question: Python Chapter 7 from the book question number 6. 6. The speeding ticket fine policy in Podunksville is $50 plus $5 for each mph over
Python Chapter 7 from the book question number 6.
6. 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.




def speedtest(speedlimit,clockedspeed) def speedtest2(speedlimit,clockedspeed) if(speedlimit)sclockedspeed) : if(speedlimit-clockedspeed) print("The speed was within the legal speedlimit." print("The speed was within the legal speedlimit." else: elif(clockspeed>90) print("The speed was over the legal speedlimit." fine = 50 + 5"((clockedspeed-speedlimit)//5) if clockedspeed90: print("The speed was over the legal speedlimit." fine = 50 + 5"((clockedspeed-speedlimit)//5) +200 print("The fine will be $",fine) fine +200 else: print("The fine will be S",fine) print( The speed was over the legal speedlimit.") fine - 50 5*(Cclockedspeed-speedlimit)//s) print"The fine will be S",fine) Look at these two solutions. Which one uses nested decisions: speedtest or speedtest2? If the speed is 50, how many condition checks does the computer make in speedtest? in speedtest2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
