Can anyone help me to resolve the driver's licence problem?? I got 3/5 test cases passed | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone help me to resolve the driver's licence problem?? I got 3/5 test cases passed

https://www.sololearn.com/coach/18?ref=app

16th Jan 2020, 10:19 AM
Ashwin
Ashwin - avatar
10 Answers
+ 3
n = str(input()) #name a = int(input()) #number of agents available w = str(input()) #waiters list w = w.split(" ") w.append(n)#add to list w = sorted(w)#sort the list q = (w.index(n)) #find index of the name t =((q//a)*20)+20#find time print(t)#print time My code worked perfectly by just taking the index as it is.
5th Feb 2020, 2:59 PM
Ashwin
Ashwin - avatar
+ 2
I did import math n = str(input()) #name a = int(input()) #number of agents available w = str(input()) #waiters list w = w.split(" ") w.append(n)#add to list w = sorted(w)#sort the list q = (w.index(n))+1 #find index of the name sw = len(w) if a % 2 != 0: if sw % 2 != 0: if len(w) != q: t =(q//a)*20#find time else: a = a - 1 t =(q//a)*20 print(k) But it crushes without a reason probably interpreter malfunction
16th Jan 2020, 3:21 PM
Flayer
Flayer - avatar
+ 1
Yes but what's your code this link shows mine make a code playground save and share it
16th Jan 2020, 12:46 PM
Flayer
Flayer - avatar
+ 1
n = str(input()) #name a = int(input()) #number of agents available w = str(input()) #waiters list w = w.split(" ") w.append(n)#add to list w = sorted(w)#sort the list q = (w.index(n))+1 #find index of the name t =(q//a)*20#find time print(t) this is the code I used.
16th Jan 2020, 1:54 PM
Ashwin
Ashwin - avatar
+ 1
import math n = str(input()) #name a = int(input()) #number of agents available w = str(input()) #waiters list w = w.split(" ") w.append(n)#add to list w = sorted(w)#sort the list q = (w.index(n))+1 #find index of the name sw = len(w) if a % 2 == 0: if sw % 2 == 0: if len(w) == q: t = q//a ta = t * 20 else: if a != 1: a = a - 1 t = q//a ta = t * 20 print(ta) I made the case 5 work and messed the 4
16th Jan 2020, 6:03 PM
Flayer
Flayer - avatar
0
Well what happens if you are 5 people you go to the line of 2 or 3
16th Jan 2020, 2:24 PM
Flayer
Flayer - avatar
0
In my code in the que of 5 people including input with line of 2 agents then as per my code o/p will be 60.
16th Jan 2020, 3:47 PM
Ashwin
Ashwin - avatar
0
Yes it may be a malfunction as you said bro
16th Jan 2020, 3:48 PM
Ashwin
Ashwin - avatar
0
Can you try it on PC and tell me what's the error
16th Jan 2020, 4:39 PM
Flayer
Flayer - avatar
0
#first (long) way ur_name = input() agents = int(input()) names = input().split() names.append(ur_name) names.sort() time = 20 count = 0 while ur_name in names: for i in range(agents): names.pop(0) count+=1 print(time*count) #second way ur_name = input() agents = int(input()) names = input().split() names.append(ur_name) names.sort() me = names.index(ur_name) print(me//agents*20+20) #this way is cool IMO ur_name, agents, names = input(), int(input()),input().split() names.append(ur_name) names.sort() me = names.index(ur_name) print(me//agents*20+20)
17th Jan 2022, 3:30 AM
Jon Adams