python programming csv file is provided at the bottom student_records.csv file

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

python programming csv file is provided at the bottom student_records.csv file

Post by answerhappygod »

python programming
csv file is provided at the bottom
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 1
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 1 (73.95 KiB) Viewed 39 times
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 2
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 2 (27.01 KiB) Viewed 39 times
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 3
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 3 (82.02 KiB) Viewed 39 times
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 4
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 4 (35.62 KiB) Viewed 39 times
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 5
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 5 (17.63 KiB) Viewed 39 times
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 6
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 6 (14.39 KiB) Viewed 39 times
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 7
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 7 (19.76 KiB) Viewed 39 times
student_records.csv file
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 8
Python Programming Csv File Is Provided At The Bottom Student Records Csv File 8 (34 KiB) Viewed 39 times
Assignment 2: Lists [1] Objectives: This assignment focuses on using lists to store and retrieve data. You will create a database system that manages student records such that you can search for or add student information. You will practice breaking the problem into smaller pieces (functions). I will provide you with one function dealing with file reading which we have not studied yet. [2] Description: You will build a student data management system that will be able to do the following operations: • Show all records • Get a specific student record • Add a new record to the database • Exit the database (without saving changes) A student record consists of five attributes: • Student ID: A 5-digit unique numeric (integer) code represents a student. • Student name: The first and last name of a student (string) • Major: The major's code (4-letter) of the student (string) • Entry: The semester the student entered the university, such as '20173' or '20161' (5-digit string) • GPA: The Grade Point Average of the student ranges from 0.00-4.00 (float) The five attributes stored in a list form a student record. Since we have many students, we will use a list to store all the student records (a list of lists). The list of lists is your primary data structure. The program should display a menu and repeatedly prompt the user to select which operation to perform. The user will input a numeric code corresponding to an option shown below.
Welcome to the student data management system Student Record Menu System: (1) Display all records (2) Get a student record (3) Add new student record (0) Exit Enter option code: I have prepared a dataset for your use. It is stored in a CSV file format. The instructor has prepared a function that will read from this file and produce a list of student records. The function is given below for your use. Detail explanation of how to use the function will be demonstrated in class. You will need to import CSV modules to run the program.
import csv *** def read file (record_file): dblist = [] with open (record_file, 'r') as stu_file: records = csv. reader (stu_file) for row in records: dblist.append([int (row[0]), row[1], row [2], row[3], float (row[4]]]] *** return dblist student_db = read_file('student records.csv') For example, the following list [28349, 'Rose Victoria', 'CHEM', '20201', 3.80] is a sample student record. A list of two student records looks like this: ● [[28349, 'Rose Victoria', 'CHEM', '20201, 3.80], [28359, 'Mary Victoria', 'cosc', '20203', 3.99]] The program will execute the requested operation and continue to prompt the user for input until the code for Exit is entered, after which the program will stop. The operations presented in the menu should have the following effects: • Show all records: go through the entire dataset list and print all the attributes of each student with a header that specifies what each column represents. • Get student record: Request the user to input a student ID and search the database for that student. If found, print the student record, or if not found, print that a student with the specified ID does not exist. • Add new student record: Request the user to input a student ID for the new record and search the database for that student. If a record with the student ID already exists, inform the user that the record cannot be added and return to the menu. If the ID is available, request the user to input the student's name, major, entry semester, and GPA. Compile this input into a list and add it to the student database list. Exit: stop the loop which causes the menu and prompt system to show up and exit the program. There is NO need to save the updated dataset. Just leave.
[3] Requirements: As mentioned previously, the dataset will be a list where each element is a list containing five elements related to student information (a list of lists). This means that for the ith student, their attributes will be: student_db[0]: student ID (integer) student_db[1]: student name (string) student_db[2]: major (string) student_db[3]: entry semester (string) student_db[4]: GPA (float) In addition, you should implement one function for each of the operations: display one record, display all records (which you can call the first one to help), search for a record, adding a record into the database. [4] Output: Sample outputs are given at the end of this document.
Welcome to the student data management system Student Record Menu Systen: (1) Display all records (2) Get a student record (3) Add new student record (0) Exit Enter option code: 1 Display all records. Stu ID Name 10347 Penelope Connor 12884 Adrian Burgess 12944 Bell Dylan 23341 Ruth Carr 25234 Carl 28349 Rose Victoria 20011 Evan Knox 24688 Miguel Gonzales 13347 Dominic Gray 42341 Heather Grace 28449 Bob Richards 20911 Joseph Darwin Glover Major Entry GPA COSC 20173 3.66 PHYS 20163 3.20 HIST 20163 4.08 ECE 20161 2.16 COSC 20193 3.67 CHEM 20203 3.82 COSC 20203 1.67 BIOL 20213 2.99 ECE 20212 2.30 EXPL 20213 3.10 ENGL 20205 POLS 20193 3.00 3.67
Student Record Menu System: (1) Display all records (2) Get a student record (3) Add new student record (0) Exit Enter option code: 2 Enter a student ID: 20011 Record found with index 6 Stu ID Name 20011 Evan Knox Major Entry GPA COSC 20203 1.67 Student Record Menu System: (1) Display all records (2) Get a student record (3) Add new student record (0) Exit Enter option code: 3 Enter the student ID for the new record: 12345 Student ID 12345 not in the list. Enter student's name: Stephen Huang Enter student's major: cosc Enter student's semester of entry: 29221 Enter student GPA: 4.00 Record added.
Student Record Menu Systen: (1) Display all records. (2) Get a student record. (3) Add new student record (0) Exit Enter option code: 1 Display all records. Stu ID Name 10347 Penelope Connor 12884 Adrian Burgess 12944 Bell Dylan 23341 Ruth Carr 25234 Carl Glover 28349 Rose Victoria 28811 Evan Knox 24688 Miguel Gonzales 13347 Dominic Gray 42341 Heather Grace 28449 Bob Richards 20911 Joseph Darwin. 12345 Stephen Huang Major Entry GPA Cosc 20173 3.66 PHYS 20163 3.20 HIST 20163 4.00 ECE 20161 2.16 COSC 29193 3.67 CHEM 20203 3.82 COSC 28283 1.67 BIOL 20213 2.99 ECE 20212 2.30 EXPL 20213 3.18 ENGL 20203 3.00 POLS 20193 3.67 COSC 20221 4.00 Student Record Menu System: (1) Display all records (2) Get a student record (3) Add new student record (0) Exit Enter option code: 0 Exiting the database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 A B C 10347 Penelope CSCI 12884 Adrian Bu PHYS 12944 Bell Dylan HIST 23341 Ruth Carr ECE 25234 Carl Glove CSCI 28349 Rose Victc CHEM 20011 Evan Knox CSCI 24688 Miguel GC BIOL 13347 Dominic GECE 42341 Heather G EXPL 28449 Bob Richa ENGL 20911 Joseph Da POLS student_records D 20173 20163 20163 20161 20193 20203 20203 20213 20212 20213 20203 20193 + LU E 3.66 3.2 4 2.16 3.67 3.82 1.67 2.99 2.3 3.1 3 3.67
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply