+ 5

Why all test are not cleared of this New Driving Licenses Code??...please tell

https://code.sololearn.com/ch6bf0O9hc9U/?ref=app

11th Feb 2020, 6:09 PM
SOUMYA
SOUMYA - avatar
7 odpowiedzi
+ 5
#So I tried to make like this your=input() agent=int(input()) other=input() b=other.split(" ") b.append(your) b.sort() for i in range(0,len(b)): if b[i]==your: x=i+1 if x>agent and agent>1 and x%2==0: x=x-agent print(x*20) elif x>agent and agent>1 and x%2!=0: x=x-agent print((x+1)*20) else: print(x*20) #still not working....all tests are not cleared
11th Feb 2020, 7:19 PM
SOUMYA
SOUMYA - avatar
+ 5
Thanks Ryan..
12th Feb 2020, 2:32 AM
SOUMYA
SOUMYA - avatar
+ 4
agent
11th Feb 2020, 6:55 PM
SOUMYA
SOUMYA - avatar
+ 4
That if condition fails when input like Eric 2 Angel baron xylene walker Sorted list=['Angel','baron','Eric','xylene','walker'] X=(2+1) X=3 Agent=2 X=X-agent X=3-2 X=1 print(1*20) Output=2o But should be 40
11th Feb 2020, 7:17 PM
SOUMYA
SOUMYA - avatar
0
'n' is not defined.
11th Feb 2020, 6:31 PM
Sarvesh Yadav
Sarvesh Yadav - avatar
0
Good evening
11th Feb 2020, 7:09 PM
Isaiah Kwao
0
[ 𝘀𝗼𝗹𝘃𝗲𝗱 ] In Your 1st code (mentioned in post) their is 'if' condition(agent>1), which is not properly defined... thats why You are failing some test case. Test Case which your code is able to pass are those in which no. of agent is 1.
11th Feb 2020, 8:27 PM
Sarvesh Yadav
Sarvesh Yadav - avatar