Python十二周作业
第一种:
class xiaoming:
"""小明"""
def __init__(self):
print("小明,10岁,男,上山去砍柴")
print("小明,10岁,男,开车去东北")
print("小明,10岁,男,最爱打游戏")
class laoli:
def __init__(self):
print("老李,90岁,男,上山去砍柴")
print("老李,90岁,男,开车去东北")
print("老李,90岁,男,最爱打游戏")
Ming=xiaoming()
Li=laoli()
第二种:
class xiaoming1(object):
"""小明"""
def __init__(self):
pass
def kanchai(self):
print("小明,10岁,男,上山去砍柴")
class xiaoming2(xiaoming1):
"""小明"""
def __init__(self):
pass
def drive(self):
print("小明,10岁,男,开车去东北")
class xiaoming3(xiaoming2):
"""小明"""
def __init__(xiaoming2):
pass
def game(self):
print("小明,10岁,男,最爱打游戏")
xiaoming=xiaoming3()
xiaoming.drive()
xiaoming.kanchai()
xiaoming.game()
class laoli1(object):
"""老李"""
def __init__(self):
pass
def kanchai(self):
print("老李,10岁,男,上山去砍柴")
class laoli2(laoli1):
"""老李"""
def __init__(self):
pass
def drive(self):
print("老李,10岁,男,开车去东北")
class laoli3(laoli2):
"""老李"""
def __init__(xiaoming2):
pass
def game(self):
print("老李,10岁,男,最爱打游戏")
laoli =laoli3()
laoli.drive()
laoli.kanchai()
laoli.game()