Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3.x This is chapter 15, Excersice 3 Question 1 (14 points): you wrote yourself Purpose: To practice testing functions Degree of Difficulty: Moderate A
Python 3.x
This is chapter 15, Excersice 3
Question 1 (14 points): you wrote yourself Purpose: To practice testing functions Degree of Difficulty: Moderate A golfer's handicap differential is calculated by the following equation: Score - Course Rating)113/Slope Rating A golfer's handicap index is a numerical measure of a golfer's potential ability. It is calculated using the average of the best 10 handicap differentials of the golfer's past 20 total rounds, multiplied by 0.96. Write the following functions: handicap differential(score, course_rating, slope_rating) takes 3 numeric arguments and re- tums a calculated handicap differential. For example, given the inputs score = 80, course-rating 72. andslope_rating-133, the result is 6.8. score and course_rating must be> 17andslope_rating must be> 54 ad 156; otherwise, the function should return 36.4 (the maximum handicap index). handicap_index (differential_list) takes a list of handicap differentials and returns the calculated handicap index. For example, given the input [6.6,8.1,9.2,8.3,8.5,3.0,7.7,9.0,6.1,8.9,9.9,6.5,8.1,7.2,5.2,3.4,9.0,9.1,3.7,9.1] the result is 7.0. If 20 rounds are given as input, only the 20 most recent rounds should be used in the calculation. Assume that round at index [o] is the oldest round and index[-1] is the most recent To show that your functions are working correctly, implement a test driver which thoroughly tests both functions with a variety of white-box tests (at least six per function). You can use either plain if-statements (as demonstrated in readings 15.2.4) or a list-of-dictionaries to implement your test driver (as demonstrated in class during chapter 15 exercise 3)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started