




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





#Student Marks Management import matplotlib.pyplot as plt
students = {} def create_student_record(name, rollno, maths, hindi, english, computer, science, sst): students[rollno] = { 'name': name, 'maths': maths, 'hindi': hindi, 'english': english, 'computer': computer, 'science': science, 'sst': sst } print("Student record successfully saved.")
def get_all_student_records(): return students def calculate_percentage(record): total_marks = sum([record['maths'], record['hindi'], record['english'], record['computer'], record['science'], record['sst']]) percentage = (total_marks / 600) * 100 return percentage def plot_student_graph(rollno): if rollno in students: record = students[rollno] percentages = [record['maths'], record['hindi'], record['english'], record['computer'], record['science'], record['sst']] subjects = ['Maths', 'Hindi', 'English', 'Computer', 'Science', 'SST']
def delete_student_record(rollno): if rollno in students: del students[rollno] print(f"Student with Roll No {rollno} deleted successfully.") else: print(f"Student with Roll No {rollno} not found.") def display_student_marks(rollno): if rollno in students: record = students[rollno] print(f"Student Name: {record['name']}") print(f"Roll No: {rollno}") print("Subject-wise Marks:") for subject, marks in record.items(): if subject not in ['name']: print(f"{subject}: {marks}") else: print(f"Student with Roll No {rollno} not found.")
def main(): while True: print("\nMenu:") print("1. Enter student details") print("2. Calculate percentage") print("3. Plot student graph") print("4. Update student marks") print("5. Delete student record") print("6. Display student marks") print("7. Close program") choice = input("Enter your choice: ") if choice == '1': name = input("Enter the name of the student: ") rollno = int(input("Enter the roll number of the student: ")) maths = float(input("Enter the marks for Maths: "))
print(f"{record['name']} (Roll No: {rollno}): {percentage:.2f}%") elif choice == '3': rollno = int(input("Enter the roll number of the student to plot the graph: ")) plot_student_graph(rollno) elif choice == '4': rollno = int (input("Enter the roll number of the student whose marks you want to update: ")) subject = input ("Enter the subject (maths/hindi/english/computer/science/sst): ").lower() new_marks = float(input(f"Enter the new marks for {subject}: ")) update_student_marks(rollno, subject, new_marks) elif choice == '5': rollno = int(input("Enter the roll number of the student whose record you want to delete: ")) delete_student_record(rollno) elif choice == '6':
rollno = int(input("Enter the roll number of the student to display marks: ")) display_student_marks(rollno) elif choice == '7': print ("Closing the program. Goodbye!") break else: print("Invalid choice. Please enter a valid option.") if name == "main": main()