Question

In python please*** in golf, par represents a standard number of strokes a player needs to complete a hole. instead of using an absolute score, players can compare their score on a hole to the par figure. families can play nine holes of miniature golf at the family miniature gold park. so that family members can compete fairly, the course provides a different par for each hole based on the player's age. the par figures are shown below:

Holes Age 4 and under 8 8 9 757 8 5 8 7 7 8 6 5 6 7 56 6 5 6 5 4 5 5 4 5 5 4 4 4 3 4 3 3 4 3 2 3 3 5-7 8-11 12-15 15 and over

1. develope the logic for a program that accepts the players name, age, and nine hole scores as input. display the players name and score on each of the nine holes, with one of the phrases "over par", "par", or "under par" next to the score.

2. modify the program so that at the end of the golfer's report, the total score is displayed. include the player's score in relation to par for the entire course.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

## Uncomment the code below to get solution for 2nd part groups-(4: [8, 8, 9, 7, 5, 7, 8, 5, 8],5:[7, 7, 8, 6, 5, 6, 7, 5, 6]

## Uncomment the code below to get solution for 2nd part

groups={4:[8, 8, 9, 7, 5, 7, 8, 5, 8],5:[7, 7, 8, 6, 5, 6, 7, 5, 6],8:[6, 5, 6, 5, 4, 5, 5, 4, 5],
12:[5, 4, 4, 4, 3, 4, 3, 3, 4],16:[4, 3, 3, 3, 2, 3, 2, 3, 3]}
print(groups[4][3])
n=int(input("Enter No.of players"))
player_list=[]
scores={}
for i in range(n):
player_list.append([input("name"),int(input("age"))])
for i in player_list:
lst=[]
for j in range(9):
print("Score for hole ",j+1)
lst.append(int(input("")))
scores[i[0]]=lst
for i in player_list:
index=0
## totalscore=0
## partotalscore=0
print("Player name:",i[0])
if(i[1]<=4):
index=4
elif(i[1]<=7):
index=5
elif(i[1]<=11):
index=8
elif(i[1]<=15):
index=12
else:
index=16
for j in range(9):
## totalscore=totalscore+scores[i[0]][j]
## partotalscore=partotalscore+groups[index][j]
if scores[i[0]][j] >= groups[index][j]:
if scores[i[0]][j] == groups[index][j]:
msg = " Par"
else:
msg = " Over par"
else:
msg = " Under par"
print("Hole",j+1," ",scores[i[0]][j],msg)
## if totalscore >= partotalscore:
## if totalscore == partotalscore:
## msg =" Par"
## else:
## msg = " Over par"
## else:
## msg = " Under par"
## print("Total Score ",totalscore,msg)

Add a comment
Know the answer?
Add Answer to:
In python please*** in golf, par represents a standard number of strokes a player needs to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT