Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will read an unknown number of bowlers and their bowling sc

ID: 3763066 • Letter: W

Question

Write a program that will read an unknown number of bowlers and their bowling scores (with possible values from 1 to 300) from an external file called "bowlingscores.txt". The file will look similar to the following
David 102 Hector 300 Mary 195 Jane 160 Sam 210
Output the bowlers names to an external data file called "bowlingaverages.txt". Next to each bowlers name, print a message dependent on their scores: For perfect scores (equal to 300) output "perfect" For scores greater than average, output "above average" For those below average , output "below average" Your program must include at least one function (e.g to calculate he average , to determine the appropriate message to print, etc) Write a program that will read an unknown number of bowlers and their bowling scores (with possible values from 1 to 300) from an external file called "bowlingscores.txt". The file will look similar to the following
David 102 Hector 300 Mary 195 Jane 160 Sam 210
Output the bowlers names to an external data file called "bowlingaverages.txt". Next to each bowlers name, print a message dependent on their scores: For perfect scores (equal to 300) output "perfect" For scores greater than average, output "above average" For those below average , output "below average" Your program must include at least one function (e.g to calculate he average , to determine the appropriate message to print, etc)
David 102 Hector 300 Mary 195 Jane 160 Sam 210
Output the bowlers names to an external data file called "bowlingaverages.txt". Next to each bowlers name, print a message dependent on their scores: For perfect scores (equal to 300) output "perfect" For scores greater than average, output "above average" For those below average , output "below average" Your program must include at least one function (e.g to calculate he average , to determine the appropriate message to print, etc)

Explanation / Answer

def bowling_scores(filename): infile = open(filename, "r") bowling_info = [] count = 0 for line in infile: parts = line.split("/n") count += 1 if count == 1 or count % 2 == 1: info["name"] = parts[0] if count % 2 == 0: info["score"] = int(parts[0]) bowling_info.append(info) infile.close() return bowling_info def bowling_avg(filename): outfile = open(filename, "r") bowling_avg = [] for key in sorted(bowling_info): score = bowling_info["score"] avg_score = (sum(score) / len(score)) avg = "" if score == 300: avg = "perfect" bowling_avg.append(avg) elif score > avg_score: avg = "above average" bowling_avg.append(avg) elif score
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote