Golf Python code Instructions The score on a golf hole is the number of strokes (hitting
Question:
Golf Python code
Instructions
The score on a golf hole is the number of strokes (hitting the ball) taken to get the ball in the hole. "Par" is the number of strokes expected for it to take to get the ball into the hole, e.g. 3, 4, or 5.
We describe the situation on a given hole in a player's game by checking the difference between the par and the actual number of strokes the player took:
"Eagle": number of strokes is two less than par
"Birdie": number of strokes is one less than par
"Par": number of strokes equals par
"Bogey": number of strokes is one more than par
"Double Bogey:" number of strokes is two more than par
"Triple Bogey:" number of strokes is three more than par
"Quadruple Bogey:" number of strokes is four more than par
Just output the message "Oh, not good..." if the number of strokes is more than four over par.
Write a program like this:
CONSOLE INPUT: Two integers, the first of which represents par and the second specifying the number of strokes actually used by the player.
CONSOLE OUTPUT:
Appropriate score name. For example if the par was 4 and the strokes was 6, print "Double Bogey"
Print "Error" if par is not 3, 4, or 5.
NOTE: Using what you have learned lately about Class design, you are expected to create a nicely organized custom class when implementing these specifications.
HINTS:
Use branching, i.e. "if-else" or "match" to write this program. Documentation of match statement. https://docs.python.org/3/whatsnew/3.10.html
WHAT TO SUBMIT: Your code in the box below.
Additional resources for assignment (download file via dropbox):
- golfTemplateCode.py https://www.dropbox.com/scl/fi/vjeu6fhrm1fod0n1dormp/golfTemplateCode.py?rlkey=xgi1010bop3y3pbq7u1zdkn5t&dl=0
Statistics For Business & Economics
ISBN: 9781337901062
14th Edition
Authors: David R. Anderson, Dennis J. Sweeney, Thomas A. Williams, Jeffrey D. Camm, James J. Cochran