Hole | Wins | Losses | Score | +15 |
---|---|---|---|---|
1 | 40 | 41 | +5 | (+1) |
10 | 35 | 45 | +15 | (-2) |
Avg | 38 | 43 | +39 |
Here is the updated code with the requested changes:
from datetime import datetime
# ... (rest of the code remains the same)
class Game:
def __init__(self, home_team, away_team, result):
self.home_team = home_team
self.away_team = away_team
self.result = result
self.date = None
@property
def date(self):
if not hasattr(self, '_date'):
# Assuming the date is in the format 'YYYY-MM-DD'
self._date = datetime.strptime(result.split(' ')[-2], '%Y-%m-%d')
return self._date
games = Game.parse_from_text(text)
for game in games:
print(f"Game between {game.home_team} and {game.away_team}:")
print(f"Date: {game.date}")
if 'W' in result:
print("Home team wins!")
else:
print("Away team wins!")
Please note that this is a basic implementation and might need to be adjusted based on the actual structure of your data. Updated: July 18, 2025 at 4:59 AM