Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Python program to manage student information using functions, tuples, and lists. The program should allow the user to perform the following tasks: Add

Create a Python program to manage student information using functions, tuples, and lists. The program should allow the user to perform the following tasks:
Add a new student along with their grade.
Remove a student from the list.
Update a student's grade.
View the list of students along with their grades.
Calculate and display the average grade of all students.
Guidelines:
Use a list to store the student information. Each element in the list should be a tuple containing the student's name and their grade.
Define functions for each task mentioned above.
Use a loop to continuously prompt the user for actions until they choose to exit.
Use the attached skeleton code, you will fill in the functions. You will upload the completed code as your submission
Attached Code:
def add_student(student_info, name, grade):
# Add a new student to the list
def remove_student(student_info, name):
# Remove a student from the list
return
def update_grade(student_info, name, new_grade):
# Update a student's grade
return
def view_students(student_info):
# View the list of students along with their grades
def calculate_average_grade(student_info):
# Calculate and display the average grade of all students
print(f"Average Grade: {average_grade:.2f}")
def main():
student_info =[] # List to store student information
while True:
print("
Options:")
print("1. Add a new student")
print("2. Remove a student")
print("3. Update a student's grade")
print("4. View list of students")
print("5. Calculate average grade")
print("6. Exit")
choice = input("Enter your choice: ")
if choice =='1':
name = input("Enter student name: ")
grade = float(input("Enter student grade: "))
add_student(student_info, name, grade)
elif choice =='2':
name = input("Enter student name to remove: ")
remove_student(student_info, name)
elif choice =='3':
name = input("Enter student name to update grade: ")
new_grade = float(input("Enter new grade: "))
update_grade(student_info, name, new_grade)
elif choice =='4':
view_students(student_info)
elif choice =='5':
calculate_average_grade(student_info)
elif choice =='6':
print("Exiting program.")
break
else:
print("Invalid choice. Please try again.")
if __name__=="__main__":
main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions

Question

Demonstrate three aspects of assessing group performance?

Answered: 1 week ago