+ 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)

13th Jan 2020, 4:21 AM
Nikita
Nikita - avatar
5 Antworten
+ 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
13th Jan 2020, 5:29 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Well done. 😁👍
14th Jan 2020, 9:48 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Specifically, the lines after others.sort() is where the wheels start coming off.
13th Jan 2020, 5:55 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Thanks, problem solved
14th Jan 2020, 9:46 AM
Nikita
Nikita - avatar
+ 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)
6th Aug 2020, 1:55 AM
Mohamed
Mohamed - avatar