Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This must be in python 3.x, please read carefully Purpose: To practice testing functions you wrote yourself. Degree of Difficulty: Moderate A golfer's handicap differential
This must be in python 3.x, please read carefully
Purpose: To practice testing functions you wrote yourself. Degree of Difficulty: Moderate A golfer's handicap differential is calculated by the following equation: (Score - CourseRating) * 113/SlopeRating 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- turns a calculated handicap differential For example, given the inputs score = 80, course-rating = 72. and slope-rating = 133, the result is 6.8. score and course-rating must be > 17 and slope-rating must be > 54 and 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,61,8.9,9.9,6.5,8.1,7.2,52,3.4,9. O,9.1,3.7,9.1] the result is 7.0. If 20 rounds are given as input, the function should return 36.4 (the maximum handicap index). 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