Python
Write a function for checking the speed of drivers.
This function should have one parameter: speed.
1. If speed is less than 55, it should print “Ok”.
2. Otherwise, for every 5 miles above the speed limit (55), it should give the driver 2 demerit points and print the total number of demerit points. For example, if the speed is 65, it should print: “Demerit Points: 10”.
3. If the driver is given more than 16 points, the function should print: “License suspended!”
Answers
Answered by
6
Answer:
1 Ans. This version of the check_speed only prints "speed OK" if the speed is exactly 55 miles per hour. It would be better to allow a range of speeds.
If we pass a speed of 45 to 60, check_speed should print "speed OK". If we pass a speed of greater than 60, check_speed should print "too fast"
Similar questions