Hole | Wins | Losses | Score | -6 |
---|---|---|---|---|
1 | 43 | 38 | +2 | (E) |
10 | 53 | 28 | -6 | (-3) |
Avg | 48 | 33 | +29 |
Here is the code in Python that reads the text and extracts the winning team for each game:
import re
# Define a dictionary to store the results
results = {}
# Read the text
text = """
# ... (rest of the text remains the same)
"""
# Extract teams from the text using regular expressions
teams = re.findall(r'(.*) - (.*)', text)
# Iterate over each game and update the results dictionary
for game in teams:
home_team, away_team = game
if home_team not in results:
results[home_team] = 0
if away_team not in results:
results[away_team] = 0
if re.search(r'\bwin\b', game):
results[home_team] += 1
# Print the winning teams and their win-loss records
for team, wins in results.items():
print(f"{team}: {wins} - {results.get(team + 's', 0)}")
This code uses regular expressions to extract the home and away teams from each game. It then updates a dictionary with the number of wins for each team. Finally, it prints out the winning teams and their win-loss records.
Note: This assumes that the text is in the same format as the sample provided, with "win" written as a word or phrase (e.g. "win", "won", "wins"). If the text uses different formats to indicate wins, this code may not work correctly. Updated: June 26, 2025 at 10:40 PM