+ 1

Code Coach | New driver license

So i was doing the new driver license challenge and this is my code: def time(name, agents, other_names): name_list = other_names.split(" ") name_list.append(name) name_list.sort() people_ahead = name_list.index(name) waves = people_ahead / agents time_to_wait = waves * 20 time_to_wait += 20 return time_to_wait ——————————————————————- for some reason all of my outputs are none. please i need some help somebody can explain this what am i missing? Thanks you

31st Mar 2020, 3:32 PM
Jason
9 Respostas
+ 1
Was def time included in the code?
3rd Apr 2020, 2:23 AM
James Clark I. Vinarao
James Clark I. Vinarao - avatar
+ 1
what do you mean?
3rd Apr 2020, 2:28 AM
Jason
+ 1
ok i know why im wrong thankss
3rd Apr 2020, 3:57 AM
Jason
+ 1
What is the correct input to correct the error in the code let others learn from you.
5th May 2020, 4:05 AM
Atanda Waheed Olaide
Atanda Waheed Olaide - avatar
+ 1
This code help you name = input(" ") agent = int(input(" ")) a,b,c,d = input(" ").split(" ") drivers = [a,b,c,d,name] drivers.sort() pos = drivers.index(name)+1 time = 20 if pos <= agent: print(time) else: rd = pos-agent if rd > agent: rdiff = rd - agent p = (rdiff*20) + 20 print(p+time) else: print(time+20)
29th Oct 2020, 5:34 AM
Krishna Kumar
Krishna Kumar - avatar
30th Jul 2021, 6:49 AM
Ankit Kumar
Ankit Kumar - avatar
0
Try taking input rather than parameter in the function.
29th Dec 2020, 1:36 PM
Charchit Dahiya
Charchit Dahiya - avatar
0
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)
17th Feb 2021, 5:00 PM
Sharique Khan
Sharique Khan - 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:33 PM
Mas'ud Saleh
Mas'ud Saleh - avatar