0

New Driver's License (Problem)

Dear Friends I've wrote this code and made a test it on PyCharm and it worked fine , but i am facing a problem here. every time i try to test a code here some issues pops up for example casting issue or input() instead of raw_input() here is the code it fails on Test case #3 and #5 def time_calc(myself, total_agents, customers): clients = customers.split(" ") clients.append(myself) clients.sort() process_time = 20 # time_to_wait = my index in the queue / total agents * process time time_to_wait = (clients.index(myself)+1) / total_agents * process_time print(time_to_wait) name = "Eric" total_agents = 2 customers = "Adam Caroline Rebecca Frank" time_calc(name, total_agents, customers) name = "Zebediah" total_agents = 1 customers = "Bob Jim Becky Pat" time_calc(name, total_agents, customers) name = "Aron" total_agents = 1 customers = "Jam Nax Olivia Sam" time_calc(name, total_agents, customers) #time_calc(input(), input(), input())

31st Dec 2019, 10:08 PM
Seif-aldin Abdulkarim
Seif-aldin Abdulkarim - avatar
3 odpowiedzi
+ 2
I solved the problem in c and the time_to_wait formula i used would look like something like this in python: time_to_wait = ((clients.index(myself)) // total_agents + 1) * process_time
1st Jan 2020, 1:58 PM
Paul
Paul - avatar
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)
25th Nov 2021, 10:28 PM
Mas'ud Saleh
Mas'ud Saleh - avatar
18th Dec 2021, 5:31 PM
PythonCoder🐍