Write a function for checking the speed of drivers. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
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