Question

In: Computer Science

Using python: The Springhill Amateur Golf Club has a tournament every weekend. The club president has...

Using python:

The Springhill Amateur Golf Club has a tournament every weekend. The club president has asked you to write a Menu-Driven program which has the following functionality:

2. Reads each player's name and golf score from the text file golf.txt and provides an average score.

Solutions

Expert Solution

The python file for the above functionality is given below. File name: players.py


file = open('golf.txt').read().split('\n')

no_of_players = len(file)

sum = 0
for scores in file:
    name_numbers = (scores.split(' '))
    sum += int(name_numbers[1])
average = sum/no_of_players

print('>>>>>>>>>>>>>>> MENU <<<<<<<<<<<<<<<')
print('1. Display Number of Players')
print('2. Display name of players with scores.')
print('3. Display average of scores.' )
choice = input('Enter your Choice. ')

if choice == 1:
    print('There are {} players listed in the file.'.format(no_of_players))
elif choice == 2:
    for scores in file:
        name_numbers = (scores.split(' '))
        print('{} has a score of {}'.format(name_numbers[0], name_numbers[1]))
elif choice == 3:
    print('The average score is {}'.format(average))
else:
    pass

The text file used is attached below. File Name: golf.txt

Nicolus_Amber 20
Tico_Salamanca 59
Maroon_Blade 46
Joshua_Orgon 30
Margon_Thaty 43
Mico_Stuart 24

Related Solutions

Gere Club Makers International manufactures golf clubs for amateur golfers and sells them in complete sets....
Gere Club Makers International manufactures golf clubs for amateur golfers and sells them in complete sets. Each set of clubs sells for $250. The costs for the company for a typical year are attached. The company expects to sell 120,000 sets of clubs per year. The company has an average income tax rate of 25%. REQUIRED: (1) How many sets of golf clubs must the company sell in order to break even? Round your answer up to the next whole...
The Club has 9 members. The club needs to elect a President, Vice President, Secretary and...
The Club has 9 members. The club needs to elect a President, Vice President, Secretary and Treasurer, how many different ways are possible? How many ways are there to find a committee of size three. The Club has 10 members, 3 freshman, 4 sophomores and 3 juniors. How many ways are there to find a committee of size three with no freshmen? How many ways are there to find a committee of size three with one freshmen?
Business Decision Case The Reserve Club is a traditional private golf and country club that has...
Business Decision Case The Reserve Club is a traditional private golf and country club that has three different categories of memberships: golf, tennis & swimming, and social. Golf members have access to all amenities and programs in the Club, Tennis & Swimming members have access to all amenities and programs except use of the golf course, and Social members have access to only the social activities of the club, excluding golf, tennis, and swimming. All members have clubhouse privileges, including...
McGilla Golf has decided to sell a new line of golf club. The clubs will sell...
McGilla Golf has decided to sell a new line of golf club. The clubs will sell for $715 per set and cost of goods sold will be 60% of sales revenue. The company has spent $250,000 for a marketing study that determined the company will sell 65,000 sets per year for seven years. The company will also increase sales of its golf balls by 200,000 boxes of a dozen balls per year. The balls sell for $35/dozen and have a...
(60 pts) McGilla Golf has decided to sell a new line of golf club. The clubs...
(60 pts) McGilla Golf has decided to sell a new line of golf club. The clubs will sell for $715 per set and cost of goods sold will be 60% of sales revenue. The company has spent $250,000 for a marketing study that determined the company will sell 65,000 sets per year for seven years. The company will also increase sales of its golf balls by 200,000 boxes of a dozen balls per year. The balls sell for $35/dozen and...
Hacker Golf has developed a unique swing trainer golf club. They currently pay a production company...
Hacker Golf has developed a unique swing trainer golf club. They currently pay a production company to produce the golf club for them at a cost of $22 each. Other variable costs total $6 per golf club, and fixed expenses are $192,000. Hacker Golf currently sells the trainer golf club for $48. NOTE: Solve each requirement as a separate situation and always go back to original data unless otherwise directed. Round all answers to nearest unit or nearest cent. Calculate...
Hacker Golf has developed a unique swing trainer golf club.  They currently pay a production company to...
Hacker Golf has developed a unique swing trainer golf club.  They currently pay a production company to produce the golf club for them at a cost of $22 each.  Other variable costs total $6 per golf club, and fixed expenses are $192,000. Hacker Golf currently sells the trainer golf club for $48.  NOTE:  Solve each requirement as a separate situation and  always go back to original data unless otherwise directed. Round all answers to nearest unit or nearest cent. A. Calculate Hacker’s annual breakeven point...
A golf club manufacturer claims that golfers can lower their scores by using the manufacturer's newly...
A golf club manufacturer claims that golfers can lower their scores by using the manufacturer's newly designed golf clubs. Eight golfers are randomly selected and each is asked to give his or her most recent score. After using the new clubs for one month, the golfers are asked again to give their most recent score. The scores for each golfer are given in the table below. Is there enough evidence to support the manufacturer's claim? Let d=(golf score after using...
A golf club manufacturer claims that golfers can lower their scores by using the manufacturer's newly...
A golf club manufacturer claims that golfers can lower their scores by using the manufacturer's newly designed golf clubs. Eight golfers are randomly selected and each is asked to give his or her most recent score. After using the new clubs for one month, the golfers are asked again to give their most recent score. The scores for each golfer are given in the table below. Is there enough evidence to support the manufacturer's claim? Let d=(golf score after using...
A golf club manufacturer claims that golfers can lower their scores by using the manufacturer's newly...
A golf club manufacturer claims that golfers can lower their scores by using the manufacturer's newly designed golf clubs. Eight golfers are randomly selected and each is asked to give his or her most recent score. After using the new clubs for one month, the golfers are asked again to give their most recent score. The scores for each golfer are given in the table below. Is there enough evidence to support the manufacturer's claim? Let d=(golf score after using...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT