Here is some sample data
Game | Date | HomeTeam | FT | HT | AwayTeam |
---|---|---|---|---|---|
1 | (Fri) 10 Aug 2018 (W32) | Manchester United FC | 2-1 | 1-0 | Leicester City FC |
2 | (Sat) 11 Aug 2018 (W32) | AFC Bournemouth | 2-0 | 1-0 | Cardiff City FC |
3 | (Sat) 11 Aug 2018 (W32) | Fulham FC | 0-2 | 0-1 | Crystal Palace FC |
Based on the user input provide the total number of goals scored by a specific team throughout the season.
Asks user for the game number and provide names of the both teams and score for the game.
This is what I have so far (note that I'm not allowed to use pandas) ...
def t_goals():
f = open("EPL_18-19_HW2.txt")
next(f)
total_goals = 0
for lines in f:
game = lines.strip().split(',')
goals = game[3].split("-")
for num in goals:
total_goals += int(num)
f.close()
return total_goals