4.23
周二,
python练习
class People:
def __init__(self, name, gender, age):
self.name = name
self.gender = gender
self.age = age
def show(self):
print("Name:", self.name)
print("Gender:", self.gender)
print("Age:", self.age)
class Student(People):
def __init__(self, name, gender, age, student_id, admission_date, admission_score):
super().__init__(name, gender, age)
self.student_id = student_id
self.admission_date = admission_date
self.admission_score = admission_score
def show(self):
super().show()
print("Student ID:", self.student_id)
print("Admission Date:", self.admission_date)
print("Admission Score:", self.admission_score)
class Teacher(People):
def __init__(self, name, gender, age, position, department, working_years):
super().__init__(name, gender, age)
self.position = position
self.department = department
self.working_years = working_years
def show(self):
super().show()
print("Position:", self.position)
print("Department:", self.department)
print("Working Years:", self.working_years)
class Graduate(Student):
def __init__(self, name, gender, age, student_id, admission_date, admission_score, research_direction,
supervisor):
super().__init__(name, gender, age, student_id, admission_date, admission_score)
self.research_direction = research_direction
self.supervisor = supervisor
def show(self):
super().show()
print("Research Direction:", self.research_direction)
print("Supervisor:", self.supervisor)
class GradOnWork(Graduate):
def __init__(self, name, gender, age, student_id, admission_date, admission_score, research_direction,
supervisor, work_unit, work_years):
super().__init__(name, gender, age, student_id, admission_date, admission_score, research_direction,
supervisor)
self.work_unit = work_unit
self.work_years = work_years
def show(self):
super().show()
print("Work Unit:", self.work_unit)
print("Work Years:", self.work_years)
p = People("张三", "男", 20)
p.show()
s = Student("李四", "女", 21, "20180101", "2018-09-01", 95)
s.show()
t = Teacher("王五", "男", 35, "副教授", "计算机科学与技术", 10)
t.show()
g = Graduate("赵六", "女", 25, "20160101", "2016-09-01", 90, "人工智能", "张三")
g.show()
gow = GradOnWork("钱七", "男", 28, "20150101", "2015-09-01", 85, "物联网", "李四", "华为", 3)
gow.show()
def __init__(self, name, gender, age):
self.name = name
self.gender = gender
self.age = age
def show(self):
print("Name:", self.name)
print("Gender:", self.gender)
print("Age:", self.age)
class Student(People):
def __init__(self, name, gender, age, student_id, admission_date, admission_score):
super().__init__(name, gender, age)
self.student_id = student_id
self.admission_date = admission_date
self.admission_score = admission_score
def show(self):
super().show()
print("Student ID:", self.student_id)
print("Admission Date:", self.admission_date)
print("Admission Score:", self.admission_score)
class Teacher(People):
def __init__(self, name, gender, age, position, department, working_years):
super().__init__(name, gender, age)
self.position = position
self.department = department
self.working_years = working_years
def show(self):
super().show()
print("Position:", self.position)
print("Department:", self.department)
print("Working Years:", self.working_years)
class Graduate(Student):
def __init__(self, name, gender, age, student_id, admission_date, admission_score, research_direction,
supervisor):
super().__init__(name, gender, age, student_id, admission_date, admission_score)
self.research_direction = research_direction
self.supervisor = supervisor
def show(self):
super().show()
print("Research Direction:", self.research_direction)
print("Supervisor:", self.supervisor)
class GradOnWork(Graduate):
def __init__(self, name, gender, age, student_id, admission_date, admission_score, research_direction,
supervisor, work_unit, work_years):
super().__init__(name, gender, age, student_id, admission_date, admission_score, research_direction,
supervisor)
self.work_unit = work_unit
self.work_years = work_years
def show(self):
super().show()
print("Work Unit:", self.work_unit)
print("Work Years:", self.work_years)
p = People("张三", "男", 20)
p.show()
s = Student("李四", "女", 21, "20180101", "2018-09-01", 95)
s.show()
t = Teacher("王五", "男", 35, "副教授", "计算机科学与技术", 10)
t.show()
g = Graduate("赵六", "女", 25, "20160101", "2016-09-01", 90, "人工智能", "张三")
g.show()
gow = GradOnWork("钱七", "男", 28, "20150101", "2015-09-01", 85, "物联网", "李四", "华为", 3)
gow.show()
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
2023-04-23 4.23打卡
2023-04-23 4.22打卡