rdhammack

Golf Score Card in Python

Jan 22nd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1. #Golf Score Card
  2.  
  3. #function to determine how well you scored per hole
  4. def golfScore(par, strokes):
  5.     if strokes == 1:
  6.         print("Hole-in-one!")
  7.     elif strokes <= par - 3:
  8.         print("Double Eagle")
  9.     elif strokes <= par - 2:
  10.         print("Eagle")
  11.     elif strokes == par - 1:
  12.         print("Birdie")
  13.     elif strokes == par:
  14.         print("Par")
  15.     elif strokes == par + 1:
  16.         print("Bogey")
  17.     elif strokes == par + 2:
  18.         print("Double Bogey")
  19.     elif strokes >= par + 3:
  20.         print("Go Home!")
  21.     else:
  22.         print("Change Me")
  23.  
  24.  
  25. #user input for hole "par" & "stroke count"
  26. holePar = input("What is the par of the current hole? ")
  27. holeStrokes = input("How many strokes did it take? ")
  28. par = int(holePar)
  29. strokes = int(holeStrokes)
  30. #prints hole stats
  31. golfScore(par, strokes)
  32.  
  33. #prints hole close message
  34. if int(holeStrokes) <= par and int(holeStrokes) > 1:
  35.     print("Great Job Champ! You're on your way to being the next Tiger Woods!")
  36. elif int(holeStrokes) == 1:
  37.     print("Amazing Job Champ! Are you sure you're not Tiger!")
  38. elif int(holeStrokes) == par + 2:
  39.     print("Better go back to the practice course!")
Add Comment
Please, Sign In to add comment