We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This code doesn't work for test case
5
-7 -7 -7 -7 -6
because his while he takes the input as lis the elements in it are strings not integers so you've to convert those elements into integers and then run the code.
N= input()
L= raw_input().split()
I=[]
assert N>=2 and N<=10
for i in L:
I.append(int(i))
I.sort()
largest=max(I)
count=I.count(largest)
for i in range(count):
I.remove(largest)
print max(I)
Find the Runner-Up Score!
You are viewing a single comment's thread. Return to all comments →
This code doesn't work for test case 5 -7 -7 -7 -7 -6 because his while he takes the input as lis the elements in it are strings not integers so you've to convert those elements into integers and then run the code.
N= input() L= raw_input().split() I=[] assert N>=2 and N<=10 for i in L: I.append(int(i)) I.sort() largest=max(I) count=I.count(largest) for i in range(count): I.remove(largest) print max(I)