Python 3.7
Students Grade
This project will have you using error handling and file handling to display mid semester report with percentage of student work and their grade. The ‘Students.csv’ file contains students name, exam1 score, exam 2 score, assignment 1 and assignment 2 scores as well. All tasks are out of 100 each. The ‘Students’ are .csv, you may find using the csv module easier to use. However, you can always read in a line and use. split.
Requirements
●Ask the user for the name of the file to open. It should continually ask until the user
responds with a file that can be opened. The user may enter quit and the program will
exit
●You will need to read each row in the following order (Name, Exam 1, Exam 2, Assignment 1, and Assignment2).
●You will need to calculate student percentage in each section as follow:
○Exam 1 worth 10% of total grade.
○Exam 2 worth 10% of total grade.
○Assignment 1 worth 5% of total grade.
○Assignment 2 worth 5% of total grade.
○Total percentage ( out of 30%) is
Exam1%+Exam2%+Assignemt1%+Assignment2%
●You will need to calculate an estimate for student grade as follow
○Student percent score (out of 100%) = (Total percentage/30)*100
●You will need also to display student grade depending on the following:
○‘A’ is 91% and above
○‘B’ is 81% - 90%
○‘B-’ is 71% - 80%
○‘C’ is 61% - 70%
○‘F’ is <=60
●You will read data from Students.csv and output all the above requirements to Students_grade.csv (Name,Exam1 score, Exam2 score,Assignment1 score, Assignment2 Score, Exam1%,Exam2%,Assignment1%,Assignment2%,Total% out of 30%, Total% out of 100%, Grade).
Development notes.
●All import statements should be at the top of the program.
●Don’t try to write it all at once, take
your time and work on one skill at a time.
Example
Enter the name of the file (quit to exit) ==> exam.csv
Could not open the file, please enter another.
Enter the name of the file (quit to exit) ==> student.txt
Could not open the file, please enter another.
Enter the name of the file (quit to exit) ==> students.csv
Reading data and outputting to Students_grade...
Enter the name of the file (quit to exit) ==> Quit
Student.csv
Homer Smith 89 97 99 90
Jack Stanely 90 100 87 94
Daniel Hackson 80 85 75 89
Sara Thomson 97 98 83 90
Thomas Elu 100 97 94 97
Sam Carol 69 40 70 60
Tina Jefferson 79 90 80 95
Sample of Students_grade.csv:
Name Ex1 Ex2 Asi1 Asi2 Ex1/10 Ex2/10 Asi1/20 Asi2/20 Total Total*100/30 Letter Grade
Homer Smith 89 97 99 90 8.9 9.7 4.95 5 28.55 95.16667 A
Jack Stanely 90 100 87 94 9 10 4.5 4.7 28.05 93.5 A
Daniel Hackson 80 85 75 89 8 8.5 3.75 4.45 24.7 82.33333 B
Sara Thomson 97 98 83 90 9.7 9.8 4.15 4.5 28.15 93.83333 A
Thomas Elu 100 97 94 97 10 9.7 4.7 4.85 29.25 97.5 A
Sam Carol 69 40 70 60 6.9 4 3.5 3 17.4 58 F
Tina Jefferson 79 90 80 95 7.9 9 4 4.75 25.65 85.5 B
Thankyou! Have a great day
'''
Python version : 3.7
Python program to read student details from a file and calculate
and output mid semester report
to output file
'''
# function to continually ask for input filename until the
user
# responds with a file that can be opened.
# The user may enter quit and the program will exit
# returns the open file object or None depending on whether user
wants to exit or not
def get_filename():
# loop that continues till user exits or provides with
a valid filename
while True:
try:
filename =
input('Enter the name of the file (quit to exit) ==> ')
if
filename.lower() == 'quit':
return None
file =
open(filename)
return
file
except IOError:
print('Could not
open the file, please enter another.')
# main function to read the input file and output the result to
output file
def main():
inFile = get_filename() # get the file object or None
if user wants to exit
# check if user wants to exit
if inFile != None:
# if user provided a valid input
file
# create the output file
outFile =
open("Students_grade.csv","w")
# output the header
information
outFile.write("Name,Ex1,Ex2,Asi1,Asi2,Ex1/10,Ex2/10,Asi1/20,Asi2/20,Total,Total*100/30,Letter
Grade")
contents = inFile.readlines() #
read the contents of the file into the list with each line being an
element of the list
inFile.close() # close the input
file
# loop over each record of input
file
for line in contents:
line =
line.strip().split(',') # split the list data using comma(,) as
delimiter to get the individual fields
# calculate the
weighted marks
weighted_marks =
[]
weighted_marks.append(float(line[1])*.1)
weighted_marks.append(float(line[2])*.1)
weighted_marks.append(float(line[3])*.05)
weighted_marks.append(float(line[4])*.05)
# calculate
weighted total
total = 0
for marks in
weighted_marks:
total += marks
# convert the
weighted total to student percent score
total_100 =
(total*100)/30
# determine the
grade
if total_100
>= 91:
grade = 'A'
elif total_100
>= 81:
grade = 'B'
elif total_100
>=71:
grade = 'B-'
elif total_100
>= 61:
grade = 'C'
else:
grade = 'F'
# output the
details to file
outFile.write('\n')
for val in
line:
outFile.write(str(val)+',')
for val in
weighted_marks:
outFile.write(str(val)+',')
outFile.write(str(total)+','+str(total_100)+','+grade)
# close the output
file
outFile.close()
print('Thankyou! Have a great day')
#call the main function
main()
#end of program
Code Screenshot:



Output:

Input file:

Output file:

Python 3.7 Students Grade This project will have you using error handling and file handling to...
Can someone help me with this problem? I have been struggling
with Python 3 for a while now and not even the professor would help
me solve this problem. I have to import a file called grades.csv
and use error handling for a mid-semester report. please help me, I
have been having trouble understand import csv. You don't have to
check for errors or anything like that. I just have to display the
mid-semester report
This project will have you...
Many classes calculate a final grade by using a weighted scoring system. For example, “Assignments” might be worth 40% of your final grade. To calculate the grade for the Assignments category, the teacher takes the percentage earned on the assignments and multiplies it by the weight. So if the student earned a 90% total on the Assignments, the teacher would take 90% x 40, which means the student earned a 36 percent on the Assignments section. The teacher then calculates...
Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...
C++: Create a grade book program that includes a class of up to 20 students each with 5 test grades (4 tests plus a Final). The sample gradebook input file (CSCI1306.txt) is attached. The students’ grades should be kept in an array. Once all students and their test scores are read in, calculate each student’s average (4 tests plus Final counts double) and letter grade for the class. The output of this program is a tabular grade report that is...
Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...
Write a program that will calculate your letter grade at the end of the semester for CSIS130. Your program will read an input file that shall contain all the tests scores and lab scores for the semester, and the input file data should be in the following format: full name of student Test1 Score (0…100), Test2 Score (0..100) , Final Exam Score (0..100), Total Number of Labs: N NLab Scores (0=Fail, 1=Pass) [You will have N lab scores each separated...
have to create five different functions above and call it in the
main fucntion.
Project Exam Statistics A CIS 22A class has two midterm exams with a score between 0 and 100 each. Fractional scores, such as 88.3 are not allowed. The students' ids and midterm exam scores are stored in a text file as shown below // id exam1 exam2 DH232 89 92 Write a program that reads data from an input file named exams.txt, calculates the average of...
Your assignment is to write a grade book for a teacher. The
teacher has a text file, which includes student's names, and
students test grades. There are four test scores for each student.
Here is an example of such a file:
Count: 5
Sally 78.0 84.0 79.0 86.0
Rachel 68.0 76.0 87.0 76.0
Melba 87.0 78.0 98.0 88.0
Grace 76.0 67.0 89.0 0.0
Lisa 68.0 76.0 65.0 87.0
The first line of the file will indicate the number of students...
use Matlab to solve
this problem, thank you
Task 5 Download the ENG1060studentmarks.txt file from the Moodle. The file contains the following information: 1. 2, 3, 4, Column 1: Student ID Column 2-11: Lab marks (/10) worth 2% each (20% total of final grade) Column 12: Assignment mark (/10) worth 10% of the final grade Column 13: Exam mark (/100) worth 70% of the final grade a) Write a function that accepts a student's laboratory, assignment and exam marks as...
codeblock c++ language
Write a program that reads students test scores in the range 0-200 from a file until end of file (use e of() to check if ifstream reaches the End of File Stream) and store those scores in an array. It should then determine the number of students having scores in each of the following ranges: 0-24, 25-49, 50-74, 75-99, 100- 124, 125–149, 150-174, and 175–200. Finally, the program outputs the total number of students, each score range...