class Birth: def __init__(self,year,month,day): self.year=year self.month=month self.day=day class Couse: def __init__(self,name): self.name=name class Score: def __init__(self,score): self.score=score class people: def __init__(self,name,birth,couse): self.name=name self.birth=birth self.couse=couse class Teacher(people): pass class Student(people): def __init__(self,name,birth,couse,score): people.__init__(self,name,birth,couse) self.score=score t1=Teacher("苍老师",Birth("1985","11","11"),Couse("python")) s1=Student("加藤同学",Birth("1975","3","15"),Couse("二指禅"),Score("666")) print(s1.name, "出生于:",s1.birth.year,s1.birth.month,s1.birth.day, "目前专业:",s1.couse.name, "成绩:",s1.score.score)