We have a text data file with 9 records. Each record has a name, a midterm score, and a final exam score. The NoGlobr Varables items in each row are tab-separated. The first couple of rows look like this. But, as we said, the data file contains 9 records total. adams 98 86 baker 92 85 carrol 59 89 ... and so on... .. he data file you will need is given in this link: cit101.txt Clicking the link probably opens the file in your browser; save it omewhere where you can find it. The name should remain cit101.txt. When I test your program it should be able to read my ata file, and it will if your data file is named cit101.txt. here are example programs similar to this assignment given in the lecture notes discussing dictionaries. se the python CSV module's csv.DictReader() approach to read the data from the file. Read the tab-separated file into a list of ictionaries when opening the file for reading, and use that list of dictionaries as the program runs. Before exiting, store the ata back to the file using the cvs.DictWriter() so it ends up in the same tab-separated format just like the file you read. he assignment will use a menu-driven model we have often used where each option is selected by entering an integer. An nage of the options you need to offer your program's user is given below. Your menu need not look identical, but should be ery similar to the following. Menu options. 1. Display all student data 2. Calculate a Student's Exam Average 3. Add a Student 4. Save and exit Choose 1, 2, 3, or 4 Enter your choice, 1, 2, 3, or 4:

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question

We have a text data file with 9 records. Each record has a name, a m i d t e r m score, and a f i n a l   e x a m score. The items in each row are tab-separated. The first couple of rows look like this. But, as we said, the data file contains 9 records total.

adams 98 86 baker 92 85 carrol 59 89 ... ... ... and so on... 
 

The data file you will need is given in this link: cit101.txt   (https://bit.ly/3LCQWfD)  Clicking the link probably opens the file in your browser; save it somewhere where you can find it. The name should remain cit101.txt. When I test your program it should be able to read my data file, and it will if your data file is named cit101.txt.

There are example programs similar to this assignment given in the lecture notes discussing dictionaries.

Use the python CSV module's csv.DictReader() approach to read the data from the file. Read the tab-separated file into a list of dictionaries when opening the file for reading, and use that list of dictionaries as the program runs. Before exiting, store the data back to the file using the cvs.DictWriter() so it ends up in the same tab-separated format just like the file you read.

You should have a main function and functions for each of the following tasks:

  • a function to display the list of all the data (option 1). You do not have to display the average in this option. But all 4 of the columns should line up neatly and be properly justified
  • a function to calculate the average of an individual student's two scores (option 2),
  • a function to add a student's last name and their m i d t e r m and f i n a l   e x a m scores to our list of students (option 3).
  • a function to store that data back to the file (option 4) in the tab-separated format, using csv.DictWriter() as you exit
  • you may or my not need a function to read the data from the file. do use the csv.DictReader() library

 

We have a text data file with 9 records. Each record has a name, a midterm score, and a final exam score. The
Global
NO
Varlables items in each row are tab-separated. The first couple of rows look like this. But, as we said, the data file
contains 9 records total.
adams
98
86
baker
92
85
carrol
59
89
and so on...
The data file you will need is given in this link: cit101.txt Clicking the link probably opens the file in your browser; save it
somewhere where you can find it. The name should remain cit101.txt. When I test your program it should be able to read my
data file, and it will if your data file is named cit101.txt.
There are example programs similar to this assignment given in the lecture notes discussing dictionaries.
Use the python CSV module's csv.DictReader() approach to read the data from the file. Read the tab-separated file into a list of
dictionaries when opening the file for reading, and use that list of dictionaries as the program runs. Before exiting, store the
data back to the file using the cvs.DictWriter() so it ends up in the same tab-separated format just like the file you read.
The assignment will use a menu-driven model we have often used where each option is selected by entering an integer. An
image of the options you need to offer your program's user is given below. Your menu need not look identical, but should be
very similar to the following.
Menu options.
1. Display all student data
2. Calculate a Student's Exam Average
3. Add a Student
4. Save and exit
Choose 1, 2, 3, or 4
Enter your choice, 1, 2, 3, or 4:
Transcribed Image Text:We have a text data file with 9 records. Each record has a name, a midterm score, and a final exam score. The Global NO Varlables items in each row are tab-separated. The first couple of rows look like this. But, as we said, the data file contains 9 records total. adams 98 86 baker 92 85 carrol 59 89 and so on... The data file you will need is given in this link: cit101.txt Clicking the link probably opens the file in your browser; save it somewhere where you can find it. The name should remain cit101.txt. When I test your program it should be able to read my data file, and it will if your data file is named cit101.txt. There are example programs similar to this assignment given in the lecture notes discussing dictionaries. Use the python CSV module's csv.DictReader() approach to read the data from the file. Read the tab-separated file into a list of dictionaries when opening the file for reading, and use that list of dictionaries as the program runs. Before exiting, store the data back to the file using the cvs.DictWriter() so it ends up in the same tab-separated format just like the file you read. The assignment will use a menu-driven model we have often used where each option is selected by entering an integer. An image of the options you need to offer your program's user is given below. Your menu need not look identical, but should be very similar to the following. Menu options. 1. Display all student data 2. Calculate a Student's Exam Average 3. Add a Student 4. Save and exit Choose 1, 2, 3, or 4 Enter your choice, 1, 2, 3, or 4:
You should have a main function and functions for each of the following tasks:
• function to display the list of all the data (option 1). You do not have to display the average in this option. But all 4 of
the columns should line up neatly and be properly justified
• a function to calculate the average of an individual student's two scores (option 2),
• a function to add a student's last name and their midterm and final exam scores to our list of students (option 3).
• a function to store that data back to the file (option 4) in the tab-separated format, using csv.DictWriter() as you exit
• you may or my not need a function to read the data from the file. do use the csv.DictReader() library
For option 2 you should be able to enter a name, like baker, and have the average of student baker's 2 scores be displayed.
For option 3 you should be able to enter a new name and two scores, and have that new record be properly saved to the data
file on option 4.
A user of your program should be able to interact with the program as much as they want before deciding to save an exit.
I recommend making a backup copy of the data file in case it gets corrupted, Please start this program early.
Transcribed Image Text:You should have a main function and functions for each of the following tasks: • function to display the list of all the data (option 1). You do not have to display the average in this option. But all 4 of the columns should line up neatly and be properly justified • a function to calculate the average of an individual student's two scores (option 2), • a function to add a student's last name and their midterm and final exam scores to our list of students (option 3). • a function to store that data back to the file (option 4) in the tab-separated format, using csv.DictWriter() as you exit • you may or my not need a function to read the data from the file. do use the csv.DictReader() library For option 2 you should be able to enter a name, like baker, and have the average of student baker's 2 scores be displayed. For option 3 you should be able to enter a new name and two scores, and have that new record be properly saved to the data file on option 4. A user of your program should be able to interact with the program as much as they want before deciding to save an exit. I recommend making a backup copy of the data file in case it gets corrupted, Please start this program early.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning