+ 1
Code coach: New driver license test fails
I have written a solution for the license driver code coach however it passes all tests except the last one, and I don't see reason to this error. Code below: https://code.sololearn.com/cjHXqYTfs5Z4/?ref=app
2 Answers
+ 3
When only one test case fails it probably involves breakpoint/corner values. since most of them are hidden, I'm not sure. I could probably look at your code and guess but I'd rather recommend you try to understand this code since it's shorter and passes all tests:
def calc_wait(me, agents, the_rest):
people = the_rest.split()
people.append(me)
people.sort()
time = 20
for name in people:
time += 20
if name == me:
break
time -= 20 * int(agents)
if time > 100:
time = 100
elif time < 20:
time = 20
print(time)
calc_wait(input(), input(), input())
+ 2
Here is my simple python code...
import math
name=input()
agent=int(input())
list=input()
list=list.split(" ")
list.append(name)
list.sort()
p=list.index(name)
min=math.ceil((p+1)/agent)*20
print(min)