Question: i need help in coding this function please Assuming that the football_scores dictionary is globally defined, implement a function called calc_points(events) that computes and returns
- i need help in coding this function please

Assuming that the football_scores dictionary is globally defined, implement a function called calc_points(events) that computes and returns the total points scored based on the list of events passed into the function. If an event does not exist in the global football_scores, you should ignore it in your calculation. There are no built-ins that you can use for this function. football_scores = { "touchdown": 6, "extra point": 1, "field goal": 3, "safety": 2, "conversion": 2} Here are some examples: . calc_points() # 0 (zero) . calc_points(["touchdown"]) # 6 . calc_points(["field down"]) # 0 (zero) . calc_points(["field goal", "touchdown", "extra point"]) # 10 . calc_points(["touchdown", "conversion", "field goal", "field goal"]) # 14 Then, implement a function called who_wins(teamA=None, teamB=None) that returns 1 if teamA scored more points than teamB, -1 if teamB scored more points than teamA, and 0 should either of the teams not report a score. You must call upon your calc_points function from above to get full credit on this part. There are no Here are some examples: . who_wins([' touchdown' , 'field goal'], ['touchdown', 'touchdown']) # returns -1 . who_win([' touchdown' 'extra point', 'field goal']) # returns 0 . who_wins(["safety", "safety", "touchdown"], ["touchdown"]) # returns 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
