Study Guide

8.1.9 Diving Contest CodeHS Answers

8.1.9 Diving Contest CodeHS Answers

The most common answer is:

fill in this function to return the total of the three judges’ scores!
judges_scores=(10,10,10)
def calculate_score(judges_scores):
return judges_scores[0]+judges_scores[1]+judges_scores[2]
print (calculate_score(judges_scores))

The function calculate_score correctly calculates and returns the total of the three judges’ scores provided in the tuple judges_scores. Just make sure to use standard ASCII quotation marks for compatibility with Python syntax:

judges_scores = (10, 10, 10)

def calculate_score(judges_scores):
    return judges_scores[0] + judges_scores[1] + judges_scores[2]

print(calculate_score(judges_scores))

It sums up the scores from each judge (10 + 10 + 10) and prints the total score.