Horje
how to find runner up score in python Code Example
how to find runner up score in python
price=[10,20,4,5,4,6,46,43,4,64,65,8,45,55,558,15,5,4,6,5,255,5]
price.sort()
price.reverse()
max=price[0]
sec_max=price[1]
print(price)
print(f"the max is {max}, runner up is {sec_max}")
find the runner-up score
n = int(input())
arr = list(map(int, input().split()))
zes = max(arr)
i=0
while(i<n):
    if zes ==max(arr):
        arr.remove(max(arr))
    i+=1
print(max(arr))
#note: do not  use set() will not work for negative numbers
# contact me : sandeshbhat2000@gmail.com
Find the Runner Up Score solution in python3
if __name__ == '__main__':
    n = int(input())
    arr = map(int, input().split())
    arr = list(arr)
    x = max(arr)
    y = -9999999
    for i in range(0,n):
        if arr[i]<x and arr[i] > y:
            y = arr[i]
    
    print(y)
how to find runner up score in python
if __name__ == '__main__':
    n = int(input())
    arr = map(int, input().split())
    lista = list(arr)
    lista.sort()
    maximo = max(lista)
    for actual in reversed(lista):
        if actual == maximo:
            lista.remove(max(lista))
    
    print(max(lista))




Python

Related
AttributeError: module 'urllib' has no attribute 'URLopener' Code Example AttributeError: module 'urllib' has no attribute 'URLopener' Code Example
moving average numpy Code Example moving average numpy Code Example
factorial python for loop Code Example factorial python for loop Code Example
how to print all combinations of a string in python Code Example how to print all combinations of a string in python Code Example
python - exclude rowin data frame based on value Code Example python - exclude rowin data frame based on value Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7