Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The medal counts for the gymnastics competitions at the 2 0 1 7 Winter Olympics for the top seven countries are as shown in the

The medal counts for the gymnastics competitions at the 2017 Winter Olympics for the top seven countries are as
shown in the file Medals.txt depicted below. The three numeric values after each country represent the countrys
count of gold, silver and bronze medals respectively.
Write a syntactically and structurally correct Python code to:
i. Retrieve information from the file and store them in appropriate lists.
ii. create a function that finds the total points scored by each country. One gold is worth 3 points, one silver is
worth 2 points, while one bronze is worth one point. Your program should multiply the medal number by
the associated points. E.g. Since Canada had 2 gold, 2 silver, and 3 bronze, the points will be obtained as
follows:
Gold points =2*3=6
Silver points =2*2=4
Bronze points =3*1=3
Total points =6+4+3=13
Call this function to compute and print out the list of countrys total points (you do not need to print out
the country names)

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

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

Persuading Your Audience Strategies for

Answered: 1 week ago