Question 1: Use Python (Class Average: Writing Student Records to a CSV File) An instructor teaches a class in which each student takes three exams. The instructor would like to store this information in a file named grades.csv for later use. Write code that enables an instructor to enter each student’s first name and last name as strings and the student’s three exam grades as integers. Use the csv module to write each record into the grades.csv file. Each record should be a single line of text in the following CSV format: firstname, lastname, exam1grade, exam2grade, exam3grade Question 2: (Class Average: Reading Student Records from a CSV File) Use the csv module to read the grades.csv file from the previous exercise (exercise 9.3). Display the data in tabular format, including an additional column showing each student’s average to the right of that student’s three exam grades and an additional row showing the class average on each exam below that exam’s column.
Question 1: Use Python
(Class Average: Writing Student Records to a CSV File)
An instructor teaches a class in which each student takes three exams. The instructor would like to store this information in a file named grades.csv for later use. Write code that enables an instructor to enter each student’s first name and last name as strings and the student’s three exam grades as integers. Use the csv module to write each record into the grades.csv file. Each record should be a single line of text in the following CSV format:
firstname, lastname, exam1grade, exam2grade, exam3grade
Question 2:
(Class Average: Reading Student Records from a CSV File)
Use the csv module to read the grades.csv file from the previous exercise (exercise 9.3).
Display the data in tabular format, including an additional column showing each student’s average to the right of that student’s three exam grades and an additional row showing the class average on each exam below that exam’s column.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images