how to find runner up score in python

Solutions on MaxInterview for how to find runner up score in python by the best coders in the world

showing results for - "how to find runner up score in python"
Serena
02 Feb 2016
1price=[10,20,4,5,4,6,46,43,4,64,65,8,45,55,558,15,5,4,6,5,255,5]
2price.sort()
3price.reverse()
4max=price[0]
5sec_max=price[1]
6print(price)
7print(f"the max is {max}, runner up is {sec_max}")
Hubert
14 Oct 2016
1from collections import Counter
2if __name__ == '__main__':
3    n = int(raw_input())
4    arr = Counter(map(int, raw_input().split())).keys()
5    arr.sort()
6    print arr[-2]
7
Elías
02 May 2020
1n = int(input())
2arr = list(map(int, input().split()))
3zes = max(arr)
4i=0
5while(i<n):
6    if zes ==max(arr):
7        arr.remove(max(arr))
8    i+=1
9print(max(arr))
10#note: do not  use set() will not work for negative numbers
11# contact me : sandeshbhat2000@gmail.com
Romeo
10 Aug 2018
1if __name__ == '__main__':
2    n = int(input())
3    arr = map(int, input().split())
4    arr = list(arr)
5    x = max(arr)
6    y = -9999999
7    for i in range(0,n):
8        if arr[i]<x and arr[i] > y:
9            y = arr[i]
10    
11    print(y)
12
Constanza
03 Oct 2019
1if __name__ == '__main__':
2    n = int(input())
3    arr = map(int, input().split())
4    lista = list(arr)
5    lista.sort()
6    maximo = max(lista)
7    for actual in reversed(lista):
8        if actual == maximo:
9            lista.remove(max(lista))
10    
11    print(max(lista))
12
queries leading to this page
runner up score hacker rank solutionrunner up in pythonfind the runner up score 21 pythonwhat is the runner up scoregiven the participants 27 score sheet for your university sports day 2c you are required to find the runner up score you are given scores store them in a list and find the score of the runner upfind the runner up score python hackerrank solutionhackerrank runner up score solutionfind the runner up score 21 hackerrank solution pythonwhat is a runner up score python2 2c3 2c4 2c5 2c5 2c5 finding runner up in python find the runner up score in pythonfind the runner up score hackerrankgiven the participants 27 score sheet for your university sports day 2c you are required to find the runner up score you are given scores store them in a list and find the score of the runner up find the runner up score hackerrank python solutionrunnerup number in an arrayfind the runner up score pythonpython find the runner up score with same valuerunner up score in pythonrunner up scoreget runnerup listhackerrank runner uppython list runner up valuecode for runner up in pythonsolving find the runner up scorerunner up score hackerrankfind the runner up scorerunner up score pythonwhat is a runner up scorewhat is an runner up scorerunner up score hacker rankrunner up score hackerrank solutionfind the runner up score in pythongiven the participants 27 score sheet for your university sports day 2c you are required to find the runner up score you are given n scores store them in a list and find the score of the runner up find the runner up score in python hackerrank solutionfind the runner up score hackerrank solution in pythonfind the runner up score hackerrank solution in pythonfind the runner up score hackerrank pythonpython runner up scoresecond runner up python challengewhat is runner up scorerunner up score program in python solutionhackerrank find the runner up score 21hackerrank find the runner up scorefind runner up scorefind the runner up score hackerrank solution python 3python find the runner up scorefind runner up score in pythonfind runner up score hack3errank solutionfind the runner up score hackerrank solution pythonfinding the runner up score python hackerrank solutions find the runner up score 21find the runner up score hackerrank solutionfind the runner up score 21 hackerrank solutionrunner up score in listrunner up program in pythonfind the runner up score 21how to check for runner up score in pythonpython find the runner up score 21 hackerrank solutionhow to find runner up score in pythonhackerrank runner up scoregiven the participants 27 score sheet for your university sports day 2c you are required to find the runner up score you are given scores store them in a list and find the score of the runner up what is runner up sfcorrefind the runner up score 21 answerrunner up score program in pythonhow to find runner up score in python