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. Choose 1, 2, 3, or 4 1. Display all student data 2. Calculate a Student's Exam Average 3. Add a Sstudent 4. Save and exit

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Need to define alternative function written in Python for csv file https://bit.ly/3LCQWfD

def Add_student(self):
student_data = []
input_str=input("enter student details- student name ,
student_data.append (input_str)
with open ('cit101.txt', 'a') as std_onj:
writerobject = csv.writer(std_obj)
writerobject.writerow(student_data)
%3D
mldterm score, final 3exam score separated by tab ")
Transcribed Image Text:def Add_student(self): student_data = [] input_str=input("enter student details- student name , student_data.append (input_str) with open ('cit101.txt', 'a') as std_onj: writerobject = csv.writer(std_obj) writerobject.writerow(student_data) %3D mldterm score, final 3exam score separated by tab ")
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:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education