Skip to content

Instantly share code, notes, and snippets.

@codephillip
Created August 25, 2022 06:27
Show Gist options
  • Save codephillip/f4f4d4267469ee78ef4697e98b67da15 to your computer and use it in GitHub Desktop.
Save codephillip/f4f4d4267469ee78ef4697e98b67da15 to your computer and use it in GitHub Desktop.

Revisions

  1. codephillip created this gist Aug 25, 2022.
    33 changes: 33 additions & 0 deletions classroom.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    class School:
    def __init__(self, name, location):
    self.name = name
    self.location = location


    class Student:
    def __init__(self, name, age, school):
    self.name = name
    self.age = age
    self.school = school


    class Teacher:
    def __init__(self, name, qualification, school):
    self.name = name
    self.qualification = qualification
    self.school = school


    class Classroom:
    def __init__(self, classnumber, teacher):
    self.classnumber = classnumber
    self.teacher = teacher
    self.students = []

    def add_student(self, student):
    self.students.append(student)

    def delete_student(self, name):
    for student in self.students:
    if student.name == name:
    self.students.remove(student)