<jupyter_start><jupyter_text>Exercise 3Add the specified code for each code cell, running the cells _in order_. Define a function **`create_game_dict()`** that takes in 4 arguments: the name of the home team in a sports game, the name of the visiting team, the home team's score, and the visiting team's score. The function should return a dictionary with keys for each of these values, for example:```{'home':'UW', 'opp': 'Rutgers', 'home_score': 48, 'opp_score': 13}```<jupyter_code>def create_game_dict(home_team, visiting_team, home_score, visiting_score):
    game_dict = {'home': home_team, 'opp': visiting_team, 'home_score': home_score, 'opp_score': visiting_score}
    return game_dict<jupyter_output><empty_output><jupyter_text>Use your function to create dictionaries representing the following games (visiting team name and score listed first):- Rutgers @ UW - 13 to 48- Idaho @ UW - 14 to 59- Portland State @ UW - 3 to 41- UW @ Arizona - 35 to 28<jupyter_code>game1=create_game_dict('UW', 'Rutger', 48, 13)
game2=create_game_dict('UW', 'Idaho', 59, 14)
game3=create_game_dict('UW', 'Portland State', 41, 3)
game4=create_game_dict('Arizona', 'UW', 28, 35)<jupyter_output><empty_output><jupyter_text>Create a variable **`season2016`** that is a _list_ containing the 4 game dictionaries. Output the list after you create it.<jupyter_code>season2016 = [game1, game2, game3, game4]

print(season2016)<jupyter_output>[{'home': 'UW', 'opp': 'Rutger', 'home_score': 48, 'opp_score': 13}, {'home': 'UW', 'opp': 'Idaho', 'home_score': 59, 'opp_score': 14}, {'home': 'UW', 'opp': 'Portland State', 'home_score': 41, 'opp_score': 3}, {'home': 'Arizona', 'opp': 'UW', 'home_score': 28, 'opp_score': 35}]<jupyter_text>Print the visiting opponent of the 3rd game played in this 2016 season.<jupyter_code>print(season2016[2]['opp'])<jupyter_output>Portland State<jupyter_text>Print out the list of games, each on their own line, in a format `"HOME vs. OPPONENT"`.<jupyter_code>for game in range(len(season2016)):
    print(season2016[game]['home'] + ' vs. ' + season2016[game]['opp'])<jupyter_output>UW vs. Rutger
UW vs. Idaho
UW vs. Portland State
Arizona vs. UW<jupyter_text>Create a variable **`home_won_count`** that is the number of games won by the home team in this piece of the 2016 season. Print out the variable.<jupyter_code>home_won_count = 0
for game in range(len(season2016)):
    if season2016[game]['home_score'] > season2016[game]['opp_score']:
        home_won_count = 1 + home_won_count
print(home_won_count)<jupyter_output>3<jupyter_text>Create a variable **`home_point_spread`** which is the _average_ number of points that the home team won by (for games that they won). Print out the variable.<jupyter_code>home_point_spread = 0
home_total = 0
for game in range(len(season2016)):
    if season2016[game]['home_score'] > season2016[game]['opp_score']:
        home_total = season2016[game]['home_score'] - season2016[game]['opp_score'] + home_total
home_point_spread = home_total / home_won_count
print(home_point_spread)<jupyter_output>39.333333333333336
{'fraction_non_alphanumeric': 0.13198959687906373, 'fraction_numerical': 0.0494148244473342, 'mean_word_length': 6.504878048780488, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '113513', 'license': 'MIT', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1017, 'n_words': 320, 'path': 'exercise-3/exercise.ipynb', 'repo_name': 'stholmes/ch9-dictionaries', 'size': '3076'}