+ 1

What is wrong in this,I got 2/5 cases failed.new driver license problem

my=input() agents=int(input()) ue=input() l=[my] u=ue.split(" ") l=u+l l.sort() list=[] for k in range(0,len(l)): list.append(l[k]) cnt=list.index(my)+1 loop=cnt//agents loop=loop*20 print(loop)

4th Apr 2020, 11:53 PM
Vinay Pal
Vinay Pal - avatar
2 Respuestas
+ 1
Basically you did a good job on this code, the step you go wrong is rounding. You need to round up the result. Change cnt//agents to cnt/agents. And use ceil() function from math module (You need to import it).
5th Apr 2020, 12:26 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Thank you CarrieForle and Alexandra,both your code worked out.problem was same but seeing two different soln from different pros amazing.
5th Apr 2020, 10:35 AM
Vinay Pal
Vinay Pal - avatar