代码
提交代码
class Person: def introduce(self): print('My name is %s, I am %d years old' % (self.name, self.age)) tom = Person() tom.name = 'tom' tom.age = 10 jerry = Person() jerry.name = 'jerry' jerry.age = 20 tom.introduce() jerry.introduce()
运行结果