forked from BeyzaNurSarikaya/Python_Modul_Library_Management
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject3_2
More file actions
35 lines (27 loc) · 1.23 KB
/
Project3_2
File metadata and controls
35 lines (27 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class School:
def __init__(self, name, fondation_year):
self.name = name
self.fondation_year = fondation_year
self.students = [] # ogrenciler listei
self.teachers = {} # ogretmenler sozlugu
def add_new_student(self, student_name, student_class):
self.students.append({"name" : student_name, "class" : student_class})
print(f"New Student added :{student_name} (class {student_class})")
def add_new_teacher(self, teacher_name, branch):
self.teachers[teacher_name] = branch
print(f"New Teacher added : {teacher_name} (branch : {branch})")
def view_student_list(self):
print("\nStudent_List")
for student in self.students:
print(f" - {student["name"]} (Class : {student["class"]})")
def view_teacher_list(self):
print("\nTeacher List:")
for teacher, branch in self.teachers.items():
print(f"- {teacher} (Branch: {branch})")
school = School("Green Valley High School", 1998)
school.add_new_student("Alice", "10A")
school.add_new_student("Bob", "9B")
school.add_new_teacher("Mr. Smith", "Mathematics")
school.add_new_teacher("Ms. Johnson", "English")
school.view_student_list()
school.view_teacher_list()