Practice Activity : Comparing Population to Olympic Medal Counts


Introduction

We all love a good Olympic story. I mean, who didn't tear up when they watched the Jamaican bobsled team in Cool Runnings?

Image result for cool runnings

We all cheer for the good old U.S. of A. but we also like to cheer for the underdogs. But what exactly does it mean to be an underdog? Sure, a team that doesn't even really know about snow is an underdog. But other than that, a single medal won by a team from a tiny country just might be more impressive than 3 medals won by a much larger country.

In this activity you will look at the ratio of size of a country compared to the # of medals it won to try to figure out which countryreally performed better than we might expect.

 


Program Guide

For this assignment you should create the following functions in a file called olympics.py. You will make three functions. The first two are smaller, helper functions, that will be used by the third function

For this assignment you will be working with several potential data sets:

 

Create a function called: totalPopulation()

This function should:

 

Create a function called: totalMedals()

This function should:

 

Create a function called: medalRatios()

This function should:

 

 


Testing Your Code

 

  1. Go to the AutoLab Homepage for the course
    1. https://hypnos.cs.uni.edu/courses/CSED1320-F21/assessments
    2. Log in if necessary
  2. For each of the assignments listed above, find their submission link under the "Practice" heading
  3. Upload the corresponding python file for that assignment.
  4. When the "handin history" page comes up you will need to refresh the page until a score of either 0 or 1 is shown with your assignment.
  5. Click on the 0/1 score to get feedback.
  6. Read the information carefully if you received a score of 0 and figure out what you need to do to fix the problem.
    • Ask for help from me or other students if you don't understand an error message.
  7. Resubmit until the program earns a 1.