17. Problem to create school management system using python

In this Python oops program, we will create a school management system using Python classes. The code demonstrates a basic implementation of a school management system using Python with the help of the below-given steps.

School management system using Python

Steps to solve the program
  1. The School class represents a school and has attributes like name, students, teachers, and courses. The __init__ method initializes these attributes.
  2. It also has methods to add and remove students, teachers, and courses from the school. These methods modify the respective lists by appending or removing the provided objects.
  3. The Student class represents a student and has attributes like name and grade. The __init__ method initializes these attributes.
  4. It also has methods to enroll and drop courses. The enroll_course method calls the add_student method of the Course class, and the drop_course method calls the remove_student method of the Course class.
  5. The Teacher class represents a teacher and has attributes like name and subject. The __init__ method initializes these attributes.
  6. It also has methods to assign and unassign courses. The assign_course method calls the add_teacher method of the Course class, and the unassign_course method calls the remove_teacher method of the Course class.
  7. The Course class represents a course and has attributes like name, students, and teacher. The __init__ method initializes these attributes.
  8. It also has methods to add and remove students, and add and remove a teacher for the course. These methods modify the respective attributes accordingly.The remaining part of the code demonstrates the usage of the class structure:
  9. An instance of the School class is created with the name “ABC School”.
  10. Instances of the Student class are created with different names and grades, and they are added to the school using the add_student method.
  11. Instances of the Teacher class are created with names and subjects, and they are added to the school using the add_teacher method.
  12. Instances of the Course class are created with names, and they are added to the school using the add_course method.
  13. Students are enrolled in courses using the enroll_course method, and teachers are assigned to courses using the assign_course method.
  14. Finally, the details of the school, students, teachers, and courses are printed using a series of loops.

Output:

Related Articles

Python Class program to create a class with data hiding.

Python Class Structure for Employee Management Application.

Leave a Comment