Question: Please help me fix this code: # Prompt user for input and output file names file 1 _ name = input ( Enter the
Please help me fix this code:
# Prompt user for input and output file names
filename inputEnter the name of input file without txt extension:
filename inputEnter the name of output file without txt extension:
# Open input and output files
with openfilename txtr as file openfilename txtw as file:
# Write headers to output file
filewrite::::::::
formatNameIDTestTestHWProject"TotalScore","Grade"
# Process each line in the input file
for linenumber, line in enumeratefilereadlines:
# Split line data by colon delimiter
data line.stripsplit:
# Extract relevant information
name datastrip
studentid datastrip
test intdatastrip
test intdatastrip
hw intdatastrip
project intdatastrip
# Calculate total score
totalscore test test hw project
# Determine grade
grade A if totalscore else B if totalscore else C if totalscore else D if totalscore else F
# Write data to output file
filewrite::::::::
formatname studentid test test hw project, inttotalscore grade
printProcess was done successfully"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
