Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.66 KB

File metadata and controls

47 lines (32 loc) · 1.66 KB

Programming Exercise: Olympic Medals Data Analysis

Write a Python program to analyze data from a CSV file named olympic_medals.csv. This file contains information about Olympic athletes, including their Name, Age, Country, and number of Gold, Silver, and Bronze medals.


Your program should:

  1. Load the data:

    • Read the CSV file, assuming well-formed data (no commas inside quoted fields).
  2. Implement functions to:

    • Calculate the total number of medals won by a specified country.
    • Compute the average age of athletes from a given country.
    • Identify the athlete with the most total medals from a country.
    • Determine which country has won the most gold medals overall.
    • List all distinct sports represented in the dataset.
    • Find the top athlete (most total medals) in a specific sport.
    • Identify the athlete with the most gold medals in a given sport.
  3. Provide a user menu that allows:

    • Selecting one of the above queries by entering a choice.
    • Inputting the required country name when needed.
    • Viewing the list of all sports available in the dataset.
    • Exiting the program gracefully.

Requirements:

  • Use appropriate data structures (lists, dictionaries) to store and process the data.
  • Handle user inputs cleanly and validate where necessary.
  • Write modular code with clear functions for each task.

Bonus (optional):

  • Add a feature to display the total number of athletes from a given country.
  • Add a filter to list athletes above a certain age.

Deliverable:

Submit a complete Python script that meets the above requirements and runs interactively via the console.