+ 1

New Drivers Licence Challenge Question

This passes all the test cases except for test case 5 can someone explain? import math name = input() agents = int(input()) other_4_people = input() # need this line to pass test case 3 if agents > 5: agents = 5 # put all names in list and sort all_names = [] for names in other_4_people.split(): all_names.append(names) all_names.append(name) all_names.sort() # finds postion in line pos = all_names.index(name) pos_in_line = pos + 1 # finding time timing = pos_in_line//agents math.ceil(timing) total = timing * 20 print(str(total))

29th Jun 2020, 8:34 PM
Ayush
3 Respuestas
0
Sandra Meyer thank you for responding. The reason i have the limitation for agents is because for some reason test case 3 won’t work without it. I have seen many posts that have that limitation to allow test case 3 to work so i have kept it there even though the program works without it. I also have changed it to normal divison, and it works, but test case 5 still won’t work. So i’m assuming it is a bug or something since everything else works, but thank you anyways.
29th Jun 2020, 10:43 PM
Ayush
0
First of all, you don't need that limitation for 5 agents. Then please make your list handling much shorter, you don't need this loop. And finally change your floor division to normal division. Then everything should work.
29th Jun 2020, 10:36 PM
Sandra Meyer
Sandra Meyer - avatar
0
I don't use this restriction and my code works (Java and Python). So I guess it's a kind of workaround to compensate a bad solution.
29th Jun 2020, 10:46 PM
Sandra Meyer
Sandra Meyer - avatar