Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 3 - Python Introduction All questions are weighted the same in this assignment. Deliverables Complete assignment in Codio Submit a pdf file with all

Assignment 3 - Python Introduction

All questions are weighted the same in this assignment.

Deliverables

  • Complete assignment in Codio
  • Submit a pdf file with all code and output to Canvs

The following code loads the olympics dataset (olympics.csv), which was derrived from the Wikipedia entry on All Time Olympic Games Medals, and does some basic data cleaning.

The columns are organized as

  • country
  • number of Summer games
  • Summer medals (gold, silver, bronze, total)
  • number of Winter games
  • Winter medals (gold, silver, bronze, total)
  • total number number of games (gold, silver, bronze, total)
  • total number of medals.

Use this dataset to answer the questions below.

Write Python code in cells below to answer each question.

Country # Summer Gold Silver Bronze Total # Winter Gold.1 Silver.1 Bronze.1 Total.1 # Games Gold.2 Silver.2 Bronze.2 Combined total ID

What is the total number of summer and winter gold medals for all countries?

Which countries are included in the dataframe? How many are there? Create a new set - countries.

Find all countries that have more than 400 total gold medals. Display country names and total number of gold medals only.

  • Which country has the most winter gold medals? Define a function winter_gold_country that will return the name of the country with most winter gold medals.
  • Which country has the most summer gold medals? Define a function summer_gold_country that will return the name of the country with most summer gold medals.

Which country has the biggest difference between their summer gold medal counts and winter gold medal counts relative to their total gold medal count?

Summer GoldWinter GoldTotal GoldSummer GoldWinter GoldTotal Gold

Only include countries that have won at least 1 gold in both summer and winter.

This function should return a single string value.

Following the dissolution of the Soviet Union in 1991,Russian Federation is recognized as a successor of the Soviet Union. Source: WikipediA as the most reliable source of information, of course.

  • Let's add a new row to the dataframe that will combine all numbers for Soviet Union and Russia. The name of the country will be "Russia and USSR".
  • Display all data for Soviet Union, Russia, and Russia and USSR.

Write a function that adds a new column called "points" to the dataframe. Column "points' is a weighted value where each gold medal (Gold.2) counts for 3 points, silver medals (Silver.2) for 2 points, and bronze medals (Bronze.2) for 1 point. The function should return only the column which you created and the country names.

What is the country with the highest "points"?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions