以下是全部代码,换一种程序,运行结果相同,如何改写?
class People():
def init(self,name,nationality):
self.name=name
self.nationality=nationality
def talk(self):
print('Communicate in language')
def walk(self):
print('Walk on two legs')
class Ch_people(People):
def init(self,name,nationality,nation):
self.name=name
self.nationality=nationality
self.nation=nation
def talk(self):
print('Exchange ideas with national language!')
peopA=People('Zong da hua','china')
print(peopA.name,peopA.nationality)
peopA.talk()
peopA.walk()
peopB=Ch_people('Zong da hua','china','Chinese')
print(peopB.name,peopB.nationality,peopB.nation)
peopB.talk()
peopB.walk()