Question: 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 addstudentstudentinfo, name, grade:
# Add a new student to the list
def removestudentstudentinfo, name:
# Remove a student from the list
return
def updategradestudentinfo, name, newgrade:
# Update a student's grade
return
def viewstudentsstudentinfo:
# View the list of students along with their grades
def calculateaveragegradestudentinfo:
# Calculate and display the average grade of all students
printfAverage Grade: averagegrade:f
def main:
studentinfo # List to store student information
while True:
print
Options:"
print Add a new student"
print Remove a student"
print Update a student's grade"
print View list of students"
print Calculate average grade"
print Exit"
choice inputEnter your choice:
if choice :
name inputEnter student name:
grade floatinputEnter student grade:
addstudentstudentinfo, name, grade
elif choice :
name inputEnter student name to remove:
removestudentstudentinfo, name
elif choice :
name inputEnter student name to update grade:
newgrade floatinputEnter new grade:
updategradestudentinfo, name, newgrade
elif choice :
viewstudentsstudentinfo
elif choice :
calculateaveragegradestudentinfo
elif choice :
printExiting program."
break
else:
printInvalid choice. Please try again."
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
