New Driver's License You have to get a new driver's license and you show up at the office at the same time as 4 other people. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

New Driver's License You have to get a new driver's license and you show up at the office at the same time as 4 other people.

name = input() agents = int(input()) clients = input() clients = clients.split() clients.append(name) clients.sort(reverse=True) time = 0 reminder = True while reminder: for i in range(agents): if clients[-1] == name: reminder = False break clients.pop() time += 1 print(time * 20)

21st Jun 2022, 11:01 AM
Ayush Tiwari
Ayush Tiwari - avatar
2 Answers
+ 1
name = input() agents = int(input()) clients = input() clients = clients.split() clients.append(name) clients.sort(reverse=True) time = 0 reminder = True while reminder: for i in range(agents): if clients[-1] == name: reminder = False break clients.pop() time += 1 print(time * 20)
21st Jun 2022, 11:12 AM
Ayush Tiwari
Ayush Tiwari - avatar
+ 1
# Hi! If it’s just shorter code you want, you can compare with this one: name, agents, other = (input() for i in range(3)) print(20 * (1 + sorted(f"{name} {other}".split()).index(name)//int(agents)))
24th Jun 2022, 10:29 AM
Per Bratthammar
Per Bratthammar - avatar