+ 1

# New driver's license test 5 failed

4 Answers

+ 2

Michael
2
Anna John Nancy Vera
output: 20
expected output: 40

+ 2

Arthur Barbosa in the example with the input from Denise's example:
Michael
2
Anna John Nancy Vera
After sorting you calculate your position to be 3 and then multiply by 20. This is 60. Then you subtract agents (2) * 20 which is 40. 60-40=20 which is not correct. Position 3 should be 40. Two people , 2 agents is 20 minutes. Then your next for 20 minutes. So that's 40.

+ 1

Thank you everybody!! I changed my code, now is working perfectly!

0

myname = input()
num_agents = int(input())
other_names = list(input().split())
other_names.append(myname)
other_names.sort()
ind_myname = other_names.index(myname)+1
print('20' if ind_myname <=num_agents else (ind_myname-num_agents)*20+20)