def Test(): ''' นี่คือตัวอย่างการเขียนโปรแกรมโดยใช้แพ๊คเก็จนี้ st1 = school.Student('Albet', 'Einstein') print(st1) st2 = Student('Bill','Gates') print([st2]) stp1 = SpecialStudent('T','E','P') teacher1 = Teacher('Ada') print(teacher1.fullname) ''' st1 = school.Student('Albet', 'Einstein') print(st1) st2 = Student('Bill','Gates') print([st2]) stp1 = SpecialStudent('T','E','P') teacher1 = Teacher('Ada') print(teacher1.fullname)
# 3. Получить список всех предметов указанного ученика # (Ученик --> Класс --> Учителя --> Предметы) # 4. Узнать ФИО родителей указанного ученика # 5. Получить список всех Учителей, преподающих в указанном классе mother1 = school.Person("Иванова", "Татьяна", "Васильевна") father1 = school.Person("Иванов", "Николай", "Александрович") mother2 = school.Person("Бойко", "Людмила", "Викторовна") father2 = school.Person("Бойко", "Дмитрий", "Игоревич") mother3 = school.Person("Остапенко", "Мария", "Дмитриевна") father3 = school.Person("Остапенко", "Тимофей", "Cергеевич") student1 = school.Student(mother1, father1, "Иванов", "Дмитрий", "Александрович") student2 = school.Student(mother2, father2, "Бойко", "Тимур", "Дмитриевич") student3 = school.Student(mother3, father3, "Остапенко", "Кирилл", "Тимофеевич") geo_subj = school.Subject("География") math_subj = school.Subject("Математика") rus_subj = school.Subject("Русский язык") math_teacher = school.Teacher(math_subj, "Васильева", "Наталья", "Борисовна") geo_teacher = school.Teacher(geo_subj, "Борисова", "Варвара", "Степановна") rus_teacher = school.Teacher(rus_subj, "Дмитриева", "Ольга", "Васильевна") class1 = school.Class(5, "A") class2 = school.Class(8, "a") class3 = school.Class(1, "В")
import os os.chdir(r'/home/gopi/Python_202004/source') import school math = school.Subject('Math', 100) ela = school.Subject('English', 50) sci = school.Subject('Science', 50) st0 = school.Student('Jane', 'Doe', 1, 'girl', [math, ela, sci]) st1 = school.Student('John', 'Doe', 2, 'boy', [math, sci]) st0.introduce('It is nice to meet you.') st1.introduce('How do you do?') st0.re_introduce() st1.re_introduce() st0.classwork() st1.classwork()
import school student_dict = {} jason = school.Student(id=1, name='Jason', age=19, score=10) student_dict[1] = jason amy = school.Student(id=2, name='Amy', age=15, score=20) student_dict[2] = amy yin = school.Student(id=3, name='Yin', age=45, score=30) student_dict[3] = yin direct = int(input('what is your student id')) if direct not in student_dict: print("cant find student oops") else: student_dict.get(direct).print()
import school amin = school.Student() print(amin.getName())
import school student_dict = {} jason = school.Student(student_id = 1, name='Jason', age=19, score = 10) student_dict[1] = jason amy = school.Student(student_id = 2, name = 'Amy', age=15, score = 20) student_dict[2] = amy