How would I solve this problem in python language
a) Write a program that reads in the names and test grades of 5 students from the data file “grades.txt”. Use the split function to separate the names and test scores and convert the test scores to numeric values.
b) Calculate the average of the test scores. c) Display the names, test scores and the average on the screen as follows:
Name Grade ---------------------
Mickey Mouse 90.0
Jane Doe 50.0
Minnie Mouse 95.0
Donald Duck 80.0
Daffy Duck 70.0
Average Grade: 77.0
d) Prompt the user for a new first name, last name and grade. e) Append the files “grades.txt” with the new data in the same format as the existing records.
# to read from file
file_name = open("grades.txt")
name = 
grades = 
for line in file_name:
# split function to take values
values = line.split(" ")
first_last_name = values + " " + values
# to calculate average
avg_test_score = sum(grades) / len(grades)
# to print the score
for i in range(len(name)):
# to take user input
first_name = input("Enter first name:")
last_name = input("Enter last name:")
grade = input("Enter grade:")
file_name1 = open("grades.txt","a")
# to write in file
write_line = "\n"+first_name+" "+last_name+ " " + str(grade)
Any “grades.txt” file can be used in place of the following “grades.txt&rdqu...
Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*See Solution
Q: Ask the user to enter the month of the year (number 1 through 12): “Enter the month of the year - nu...
A: The algorithm for the program would be as below:Declare one int variable for accepting user inputPro...
Q: What is the output of the following code? def test_func (*a) print (a) test_func1,2,3,4) test fun...
A: Consider the given code:#Function definition test_func()def test_func(*a): #Print the output p...
Q: Consider the client A sends the data of 12 bytes to the sender B using the UDP. What is the efficien...
A: Efficiency:In User Datagram Protocol (UDP), the formula for computing efficiency of the transmission...
Q: this is a problem that I have how would I go about solving it? Stadium Seating There are three seati...
A: Algorithm: Include required header files.Define main function.Initializes the seat prices for class ...
Q: How do I write a code that places my name in an email link? Thanks
A: As there is no particular programming language mentioned, we are doing this using HTML code.
Q: Do you think technologies like Big Data and Predictive Analytics in Marketing would have worked 10-1...
A: The technologies like Big Data would not have worked 10-15 years back as due to lack of large datase...
Q: Write a program to convert between KPH and MPH in either direction.If you are driving across the bor...
A: Click to see the answer
Q: how can I create comments in python?
A: In python, # character is used to start the single line comments. Place a hash symbol in front of a ...
Q: What are the mantissa and exponent values if 6.75 is represented in 8-bit binary floating-point repr...
A: Conversion of decimal to 8-bit floating point representation:Step 1: Convert the integer part of the...