Question: Problem 3 : CSV File Handling Points Possible: 3 0 This problem will provide you with an opportunity to demonstrate your understanding of reading from

Problem 3: CSV File Handling
Points Possible: 30
This problem will provide you with an opportunity to demonstrate your understanding of reading from and writing to CSV files and demonstrating exception handling in your Python programs.
Instructions:
Write a Python program that writes user input to a CSV file, reads the data back from the CSV file, and incorporates exception handling. You will perform the following steps:
Prompt the user to enter a students name, their grade, and the course name.
If the user does not enter a valid grade (i.e.,a positive integer),your program should catch this error and ask for the input again.
Open a new file in write mode named student_grades.csv and write the user's information to this file in CSV format.
Make sure you handle exceptions if you do not have write permissions for the file or other IO errors occur.
Now open the student_grades.csv file in read mode.
Make sure your code handles any exceptions if the file is not found or other IO errors occur.
Read the content of the file and store it in a variable.
Print the contents of this variable to the console/shell.
Provide comments in your code to explain the logic used.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!