+ 5
Why all test are not cleared of this New Driving Licenses Code??...please tell
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
+ 5
Thanks Ryan..
+ 4
agent
+ 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
0
'n' is not defined.
0
Good evening
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.