Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the below function that reads football game scores from a file called scores.txt (you can assume it always exists), computes a dictionary where keys

Complete the below function that reads football game scores from a file called "scores.txt" (you can assume it always exists), computes a dictionary where keys are team names and values are the corresponding points, and returns the dictionary. All teams, even if they have obtained 0 points, must be represented in the dictionary. The format of "scores.txt" is as follows (the following is just an example): TeamA TeamB 3 2 TeamA TeamC 2 0 TeamC TeamB 1 1 This means, TeamA won against TeamB by scoring 3 goals versus 2. From this game TeamA obtains 3 points (each win is 3 points) and TeamB obtains 0 points (each lose is 0 points). In the second game TeamA defeated TeamC 2 to 0, and received another 3 points, whereas TeamC received 0 points. Finally, TeamC and TeamB had a draw in the last game and each received 1 point (each draw is 1 point). As a result TeamA obtained 6, TeamB obtained 1 and TeamC obtained 1 points. The function must then return the following dictionary: {"TeamA":6, "TeamB":1, "TeamC":1} You don't know how many teams or games exist in the file. Teams are not guaranteed to play the same number of games. """ def pointCalculator(): return # Remove this line if you want to answer this question

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions