设计person类 属性:姓名,年龄,身高 方法:跑,说话,吃饭
时间: 2023-05-28 12:04:49 浏览: 97
设计一个Personal类
class Person:
def __init__(self, name, age, height):
self.name = name
self.age = age
self.height = height
def run(self):
print(f"{self.name} is running.")
def talk(self):
print(f"{self.name} is talking.")
def eat(self):
print(f"{self.name} is eating.")
阅读全文