写代码如下:

class Teacher: def init(self, name, id, gender, birthday, id_card, position, department): self.name = name self.id = id self.gender = gender self.birthday = birthday self.id_card = id_card self.position = position self.department = department

class Assistant: def init(self, name, id, gender, birthday, id_card, position, department, class_num, major, mentor): self.name = name self.id = id self.gender = gender self.birthday = birthday self.id_card = id_card self.position = position self.department = department self.class_num = class_num self.major = major self.mentor = mentor

teacher = Teacher("Zheng Li", 1001, "Female", "1978-01-01", "1234567890", "professor", "CST") assistant = Assistant("Li Chao", "011401", "Male", "1988-06-01", "12345619880601", "TA", "CST", "cst61", "computer science", teacher.name)

print("助教姓名:", assistant.name) print("助教编号:", assistant.id) print("助教部门:", assistant.department) print("助教班号:", assistant.class_num) print("助教专业:", assistant.major) print("助教导师:", assistant.mentor


原文地址: https://www.cveoy.top/t/topic/hllf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录