San Diego State University Programming Question
- February 06, 2022/ Homework Tutors
Upload 2 files: the program as a “.py” file. A copy of its execution as a notepad or word file
Write and execute a Python program for the following problem where a few simple statistics for a soccer league week will be computed.
Each team plays one match. Each match has a winner and a loser. In a match, one team is the home team, and one team is the visiting team. At least one goal is scored in any match.
Data will be read in the following order, one match after the other:
Name of home team
Score of the home team
Name of the visiting team
Score of the visiting team
Enter “done” when there is no more matches.
Calculate and display the following results.
Number of games
Number of wins by the home teams, number of wins by the visiting teams.
Total number of goals and average scored by the home teams, by the visiting teams
Total number of goals and average conceded by the home teams, by the visiting teams
Total and average goal differential for the home teams
Total and average goal differential for the winning teams
Team with the largest number of goals scored, team with the largest goal differential (if several teams have the same value, pick any one). Indicate if home team or visiting team.
Execute the program on the following data (each data must be on separate line, not like here). Do not use advance features such as lists, tuples, arrays. Data must be inputted by execution of the program, they must not be “hard-coded” in the program)
AA 4 Bb 0
Cix 2 Doe 6
Elo 1 PSG 7
OM 3 As 0
MU 10 Mc 3
Rm 1 Bar 8
Losc 5 Br 14