To display total score for each diver define two variables
One list and one integer number
all_scores is a list and keeps track on what the diver has scored overall.
total_score is just an integer of the total score, Total_score is later used to subtract highest and lowest score from the variable
Code:
#Converts list to int
def convertToInt(numList): # [1,2,3]
s = map(str, numList) # ['1','2','3']
s = ''.join(s) # '123'
s = int(s) # 123
return s
for index in range(len(diver_name)):
#Diver name
print(diver_name[index], "-", diver_country[index])
all_scores = []
total_score = 0
#Scores
for scores in randomScore():
all_scores.append([scores]) // adds the score on to list
total_score += scores // adds the score to the total_score value
print(all_scores)
#Gets the maximum and minimum
maximum_score = max(all_scores)
minimum_score = min(all_scores)
#Converts to integer
maximum_score = convertToInt(maximum_score)
minimum_score = convertToInt(minimum_score)
#Displays maximum and minimum
print("Maximum score: %d" %maximum_score)
print("Minimum score: %d" %minimum_score)
total_score -= maximum_score
total_score -= minimum_score
#Total
print("Total score : %d\n" %total_score)
Regarding displaying the OVERALLSCORE of the divers. I would suggest creating a overall score list and then:
Here is a way of how you can structure it (Dummy code):
The curly brackets are there to show you what is inside and outside the loop. (this is not correct python syntax)
Code:
overall_score = []; // outside of processing driver loop
for(process_driver) {
for(processes_total_score) {
}
overall_score.append([driver_name, total_score]) // inside of processing diver loop
}
Winner = find_largest_score(overall_score[]) // you need a function to loop through the scores and find the max() number
//assuming find_larget_score() returns a list, it can be like this ['divername', 123']
// %s is the diver name %d is the score.
print(“Diver: %s has won scoring %d”, winner[0], winner[1])
//winner[0] is name and [1] is score.
I am only trying to give an example. it does not work. The idea is that after the total score for each driver is calculated it is added to the overall score.
I hope this helps.