0

Write a function for checking the speed of drivers.

Write a function for checking the speed of drivers. This function should have one parameter: speed.  If speed is less than 70, it should print “Ok”.  Otherwise, for every 5km above the speed limit (70), it should give the driver one demerit point and print the total number of demerit points. For example, if the speed is 80, it should print: “Points: 2”.  If the driver gets more than 12 points, the function should print: “License suspended”

14th Jun 2020, 12:23 PM
Ishu Goyal
Ishu Goyal - avatar
3 Respuestas
0
I am still thinking but its jst dosnt seem to crack 😪 can think of only the long way but it will be too many if n else statement
14th Jun 2020, 12:30 PM
Ishu Goyal
Ishu Goyal - avatar
0
Before we can help you, please do a try by yourself, put it in playground and post it here. Thanks!
14th Jun 2020, 1:40 PM
Lothar
Lothar - avatar
0
if(speed<70)print(“Ok”) else { print("Points:"+((speed-70)/5)); if((speed-70)/5)>12) print(“License suspended”); }
29th Aug 2020, 9:05 AM
Stephen Gosema
Stephen Gosema - avatar