I am needed to create a program that could be used by judges judging a diving competition, where there is 7 judges and the lowest and highest scores are removed and the average is then calculated. this is what i have so far however it does not work. Can anyone help. Thankyou.

def main():
    total=0
    highScore=0.0
    lowScore=10.0
    scoreCounter = 0
    score=0
    diverName = raw_input ('Enter divers name:')
    degreeOfDifficulty= input ('Enter degree of difficulty')
    for scoreCounter in range(0,7,1):
        score = input ('enter score: ')
    if score < lowScore:
        lowScore = score
    elif score > highScore:
        highScore = score
    scoreCounter = scoreCounter + 1
    print 'lowscore = ', lowScore, 'highscore = ', highScore
    subTotal= subTotal + score
    totalResult= subTotal - lowScore - highScore
    totalResult = totalResult * degreeOfDifficulty * 3/5
    print '\n\n The final score for diver ', diverName,' is ',totalResult, '.'

    
main()

Like this maybe. The list and sorting it makes it easy.

def main():
    diverName = raw_input('Enter divers name: ')
    degreeOfDifficulty = input('Enter degree of difficulty: ')
    scoreList = []
    for scoreCounter in range(1, 8):
        scoreList.append(input('Enter score %s: ' % scoreCounter))
    sortedScores = sorted(scoreList)
    print '\nhighscore = %s\nlowscore = %s' % (sortedScores[6], sortedScores[0])
    totalResult = 0
    for i in range(1, 6):
        totalResult += sortedScores[i]
    totalResult = totalResult * degreeOfDifficulty * 3/5
    print '\nThe final score for diver %s is %s.' % (diverName, totalResult)

    
main()

Cheers and Happy coding

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.