Please help me with my program in python. The program requires the average, the lowest grade, the highest grade, and how many scores are below the average obtained. I dont know where will I input it. Pls help me. -- import csv # Define global variables student_fields = [' Student No.', ' Name', ' Age', ' Email address', ' Math Grade', ' Physics Grade', ' Computer Grade'] student_database = 'students.csv' def display_menu(): print("--------------------------------------") print(" Welcome to Student Manager System ") print("--------------------------------------") print("1. Add New Student") print("2. View Students") print("3. Search Student") print("4. Update Student") print("5. Delete Student") print("6. Quit") def add_student(): print("-------------------------") print("Add Student Information") print("-------------------------") global student_fields global student_database student_data = [] for field in student_fields: value = input("Enter" + field + ": ") student_data.append(value) with open(student_database, "a", encoding="utf-8") as f: writer = csv.writer(f) writer.writerows([student_data]) print("Data saved successfully") input("Press any key to continue") return def view_students(): global student_fields global student_database print("--- Student Records ---") with open(student_database, "r", encoding="utf-8") as f: reader = csv.reader(f) for x in student_fields: print(x, end='\t |') print("\n-----------------------------------------------------------") for row in reader: for item in row: print(item, end="\t |") print("\n") input("Press any key to continue") def search_student(): global student_fields global student_database print("--- Search Student ---") roll = input("Enter student no. to search: ") with open(student_database, "r", encoding="utf-8") as f: reader = csv.reader(f) for row in reader: if len(row) > 0: if roll == row[0]: print("----- Student Found -----") print("Student No.: ", row[0]) print("Name: ", row[1]) print("Age: ", row[2]) print("Email Address: ", row[3]) print("Math: ", row[4]) print("Physics: ", row[5]) print("Computer: ", row[6]) print("Average: ", row[7]) print("Highest Mark:", row[8]) print("Lowest Mark:", row[9]) print("# of Mark Below Ave:", row[10]) break else: print("Student No. not found in our database") input("Press any key to continue") def update_student(): global student_fields global student_database print("--- Update Student ---") roll = input("Enter Student No. to update: ") index_student = None updated_data = [] with open(student_database, "r", encoding="utf-8") as f: reader = csv.reader(f) counter = 0 for row in reader: if len(row) > 0: if roll == row[0]: index_student = counter print("Student Found.: at index ",index_student) student_data = [] for field in student_fields: value = input("Enter " + field + ": ") student_data.append(value) updated_data.append(student_data) else: updated_data.append(row) counter += 1 # Check if the record is found or not if index_student is not None: with open(student_database, "w", encoding="utf-8") as f: writer = csv.writer(f) writer.writerows(updated_data) else: print("Student No. not found in our database") input("Press any key to continue") def delete_student(): global student_fields global student_database print("--- Delete Student ---") roll = input("Enter Student No. to delete: ") student_found = False updated_data = [] with open(student_database, "r", encoding="utf-8") as f: reader = csv.reader(f) counter = 0 for row in reader: if len(row) > 0: if roll != row[0]: updated_data.append(row) counter += 1 else: student_found = True if student_found is True: with open(student_database, "w", encoding="utf-8") as f: writer = csv.writer(f) writer.writerows(updated_data) print("Student No. ", roll, "deleted successfully") else: print("Student No. not found in our database") while True: display_menu() choice = input("Enter your choice: ") if choice == '1' : add_student() elif choice == '2' : view_students() elif choice == '3' : search_student() elif choice == '4' : update_student() elif choice == '5' : delete_student() else: break print("-------------------------------") print(" Thank you for using our system") print("-------------------------------")

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

Please help me with my program in python.

The program requires the average, the lowest grade, the highest grade, and how many scores are below the average obtained. I dont know where will I input it. Pls help me.

--

import csv

# Define global variables

student_fields = [' Student No.', ' Name', ' Age', ' Email address', ' Math Grade', ' Physics Grade', ' Computer Grade']

student_database = 'students.csv'

def display_menu():

print("--------------------------------------")

print(" Welcome to Student Manager System ")

print("--------------------------------------")

print("1. Add New Student")

print("2. View Students")

print("3. Search Student")

print("4. Update Student")

print("5. Delete Student")

print("6. Quit")

def add_student():

print("-------------------------")

print("Add Student Information")

print("-------------------------")

global student_fields

global student_database

student_data = []

for field in student_fields:

value = input("Enter" + field + ": ")

student_data.append(value)

with open(student_database, "a", encoding="utf-8") as f:

writer = csv.writer(f)

writer.writerows([student_data])

print("Data saved successfully")

input("Press any key to continue")

return

def view_students():

global student_fields

global student_database

print("--- Student Records ---")

with open(student_database, "r", encoding="utf-8") as f:

reader = csv.reader(f)

for x in student_fields:

print(x, end='\t |')  

print("\n-----------------------------------------------------------")

for row in reader:

for item in row:

print(item, end="\t |")  

print("\n")  

input("Press any key to continue")  

def search_student():

global student_fields

global student_database

print("--- Search Student ---")

roll = input("Enter student no. to search: ")

with open(student_database, "r", encoding="utf-8") as f:

reader = csv.reader(f)

for row in reader:

if len(row) > 0:

if roll == row[0]:

print("----- Student Found -----")

print("Student No.: ", row[0])   

print("Name: ", row[1])

print("Age: ", row[2])

print("Email Address: ", row[3])

print("Math: ", row[4])

print("Physics: ", row[5])

print("Computer: ", row[6])

print("Average: ", row[7])

print("Highest Mark:", row[8])

print("Lowest Mark:", row[9])

print("# of Mark Below Ave:", row[10])

  

break

else:

print("Student No. not found in our database")

input("Press any key to continue")  

def update_student():

global student_fields

global student_database

print("--- Update Student ---")

roll = input("Enter Student No. to update: ")

index_student = None

updated_data = []

with open(student_database, "r", encoding="utf-8") as f:

reader = csv.reader(f)

counter = 0

for row in reader:

if len(row) > 0:

if roll == row[0]:

index_student = counter

print("Student Found.: at index ",index_student)

student_data = []

for field in student_fields:

value = input("Enter " + field + ": ")

student_data.append(value)

updated_data.append(student_data)

else:

updated_data.append(row)

counter += 1

# Check if the record is found or not

if index_student is not None:

with open(student_database, "w", encoding="utf-8") as f:

writer = csv.writer(f)

writer.writerows(updated_data)  

else:

print("Student No. not found in our database")

input("Press any key to continue")

def delete_student():

global student_fields

global student_database   

print("--- Delete Student ---")

roll = input("Enter Student No. to delete: ")

student_found = False

updated_data = []

with open(student_database, "r", encoding="utf-8") as f:

reader = csv.reader(f)

counter = 0

for row in reader:

if len(row) > 0:

if roll != row[0]:

updated_data.append(row)

counter += 1

else:

student_found = True

if student_found is True:

with open(student_database, "w", encoding="utf-8") as f:

writer = csv.writer(f)

writer.writerows(updated_data)

print("Student No. ", roll, "deleted successfully")

else:

print("Student No. not found in our database")  

while True:

display_menu()

choice = input("Enter your choice: ")

if choice == '1' :

add_student()

elif choice == '2' :

view_students()

elif choice == '3' :

search_student()

elif choice == '4' :

update_student()

elif choice == '5' :

delete_student()

else:

break

print("-------------------------------")  

print(" Thank you for using our system")

print("-------------------------------")

Expert Solution
steps

Step by step

Solved in 5 steps with 8 images

Blurred answer
Knowledge Booster
Array
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
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