Question 19
What is the output of the following code? [3 marks]
Solution
Initialize variable scores with list [90, 75, 60].
We also now initialize variable score_diff to be a tuple containing 3 values:
abs(scores[0]-scores[1]):abs(90-75) = abs(15) = 15abs(scores[2]-scores[0]):abs(60-90) = abs(-30) = 30abs(scores[2]-scores[1]):abs(60-75) = abs(-15) = 15
score_diff is the tuple (15, 30, 15).