Find the Runner-Up Score!

  • + 1 comment
    if __name__ == '__main__':
        n = int(input())
        arr = map(int, input().split())
        scores = list(set(arr))
        if n < 2 and n > 10:
            print("Invalid input: n must be between 2 and 10")
        for i in range(len(scores)):
            if scores[i] < -100 or scores[i] > 100:
                print("Invalid input: scores must be between -100 and 100")
                break
        scores.sort()
        print(scores[-2] if len(scores) > 1 else scores[0])