+ 1
New driver license 3/5 passed, what's wrong
import math my_n=input().split() nam=''.join(my_n) agents=int(input()) others=list(input().split()) others.append(nam) others.sort() k=others.index(nam) k=len(others[:k+1]) h=math.ceil(((k)*20) /agents) print(h)
5 Respostas
+ 3
Your code is not returning waiting periods which are in 20 minute increments.
Example:
rik
3
bob zac col bill
returns 27 instead of 40.
Test your functions against different agent numbers and names
+ 3
Well done. 😁👍
+ 2
Specifically, the lines after
others.sort() is where the wheels start coming off.
+ 1
Thanks, problem solved
+ 1
license_time = 20
me = input()
agents = int(input())
clients = input().split()
clients.append(me)
clients.sort()
waiting_time = ((clients.index(me)) // agents + 1) * license_time
print(waiting_time)