[Solved] New Driver's License Challenge.
[Solved] The issue was no of agents. Don't know why i didn't handled it. ! I could not solve this challenge. Tried few ways nothing worked then out of frustration i hard coded different combination. But even that didn't worked and i am unable to figure out why? Link to the hard coded version is below. Someone please tell why this version is not working. Note: I have already solved the challenge, and want to know the issue with this hard coded version. I must be making some really silly error. This is frustrating and i know probably it has cost me a chance to be a pro member. https://code.sololearn.com/cPM4qGE08WXJ/?ref=app
12/22/2019 10:33:46 AM~ swim ~ (Inactive Till Year End)
25 AnswersNew Answer
Sorry for fail to get pro. We have same problem because Google play was unable to update in that period of time 😔😒😒 And we were late for coaching 😭😫😫
I've now only tested 2 cases. But works as expected. What do you think goes wrong?
Coder Kitten I thought about that but then dismiss it as it is not going to make the difference as the input is only 5 people. Besides test cases are not thorough. It does not check the input properly. One can also enter no of agents as 0
It is solved now, the no of agents is the issue. Do not why it didn't occured to me ! Damn all i know probably it cost me the pro membership. Anyways Thank you guys :)
No, that's Not the point. I've tested this, and is ok for All cases import math me = input() agends = int(input()) others = input().split() if agends > 5: agends = 5 waiting = others.copy() waiting.append(me) waiting.sort() pos = 1 + waiting.index(me) time = (math.ceil(pos/agends))*20 print(time)
For this discussion, I've added this two lines.: If agends > 5 agends = 5 It Passes all Tests. Normaly it works w/o this boths lines.
https://code.sololearn.com/c4972WE54JWy/?ref=app This is my code for that question. I hope this may help you.
That's the mystry to me also. I can make error if i try to come up with some formula, but the hardcoded version is failing too, is quite baffling to me.
Yes at sololearn coding coach test case no 3.
Coder Kitten Ideally the problem statement should tell what to do for invalid input, but the test cases are not checking that. for input i can enter 0 as no of agents or can enter more than 5 names. Malformed input is not being checked for any challenges. Did you checked for more than 5 agents in your code? If yes then what error messge are you displaying or how have you handled it?
Coder Kitten I'll try for the next time if they come up with some contest again. I am seriously thinking how did i missed that, normally don't really make such silly mistakes. Thank for your time and help :)
~ swim ~ in any competitive programming challenges, all the inputs tested are always valid. so you don't need to handle them to avoid errors. let's say a question only has integer inputs, the test input will never turn into a string and test whether the program can handle strings or not. if they don't clearly state it, then you don't have to do exception handling at all. that is what my past experience in competitive programming are like
Ok, you mean it fails at the SL test cases?
Do you speak Ukrainian and Russian?
Baccano 76 I don't know to whom your question is directed to? I do not speak Ukrainian and Russian.
Baccano 76 I don't know to whom your question is directed to? I do not speak Ukrainian and Russian. Okay...
alex tom Do not post in random thread if you have nothing to contribute. Can't understand why do some people have sudden urge to post some nonsense in some random thread !
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) My code passed all the test cases