Question: Need help with writing a Python program using these data from a txt file. 5 statistic: GF per game GA per game shots for per
Need help with writing a Python program using these data from a txt file.
5 statistic:
GF per game
GA per game
shots for per game
shots against per game
PK%
txt file:
Arizona Coyotes
2.75
2.44
33.2
30.9
91.8
False
San Jose Sharks
3.11
2.94
36.1
28.3
87.7
True
Tampa Bay Lightning
3.65
2.82
33.8
32.1
87.7
True
Minnesota Wild
3.18
2.53
30.9
31.5
85.2
True
Vegas Golden Knights
2.39
2.94
34.7
26.0
84.3
False
Pittsburgh Penguins
3.40
3.00
32.7
33.6
83.3
True
Colorado Avalanche
3.47
2.88
29.9
32.6
82.8
True
New Jersey Devils
3.00
3.60
32.8
31.8
82.5
False
St. Louis Blues
3.47
3.40
30.3
31.8
82.3
False
Los Angeles Kings
2.06
3.13
27.9
29.9
82.2
False
Toronto Maple Leafs
3.41
2.71
31.2
31.5
82.0
True
Montral Canadiens
3.29
3.24
33.1
29.6
81.7
False
Buffalo Sabres
3.06
3.06
33.0
32.1
81.5
True
Dallas Stars
2.94
2.82
30.1
31.2
81.5
False
New York Islanders
3.00
2.56
27.1
33.4
81.1
False
Winnipeg Jets
3.19
2.63
31.9
33.5
81.0
True




3 Utilizing dictionaries, lists, and functions For the third part of this project, you will have to redo your previous solution to split it up into multiple parts. Specifically, you will be writing 2 functions (one of which should be able to be called 2 different ways) to aid in your analysis readFile(filename) The first function, readFile, should be written with a default argument value so that it can be called with either one or two arguments (with or without the winner argument). When called with only the filename argument, it should be used to read a file specified by filename and produce a dictionary containing all of the stats for each team or competitor. Each entry in the dictionary should be a list containing the stats for a single team. Hence, the dictionary will contain n sublists where n is the number of teams/competitors. For the NHL example, this would be the result: "Pittsburgh Penguins":2.94 2.43 33.229.784.4 "New Jersey Devils": 2.222.46 24.428.6 83.0 readFile(filename, winner) When called with two arguments (both filename and winner), readFile should operate in a very similar way, but it should only process only a portion of the file specified by filename. If winner is set to True, it should return a dictionary containing only the stats of teams/competitors that are considered winners (e.g., NHL teams that made the playoffs). If set to False, it should return a dictionary of only teams/competitors who are not considered winners (e.g., NHL teams that did not make the playoffs)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
