You are viewing a single comment's thread. Return to all comments →
My very basic approach:
if name == 'main':
numberOfRequiredScores = int(input()) if 2 <= numberOfRequiredScores <= 10: rawInput = str(input()) if rawInput: scoresNumericMap = map(int, rawInput.split()) scoresList = list(scoresNumericMap) finalScoresList = [] iCounter = 0 for i in scoresList: iCounter +=1 finalScoresList.append(i) if iCounter == numberOfRequiredScores: break numOfScoresEntered = len(scoresList) numOfFinalScores = len(finalScoresList) highestScore = max(finalScoresList) runnerUpScore = None for score in finalScoresList: if not (-100 <= score <= 100): continue if score == highestScore: continue if not runnerUpScore: runnerUpScore = score continue if score > runnerUpScore: runnerUpScore = score if runnerUpScore is not None: print(runnerUpScore)
Seems like cookies are disabled on this browser, please enable them to open this website
Find the Runner-Up Score!
You are viewing a single comment's thread. Return to all comments →
My very basic approach:
if name == 'main':