python刚自学,有一个关于类的问题

定义宠物类型,创建多个宠物,如狗,兔子,猫,鹦鹉,仓鼠,乌龟等,展示每个宠物信息,如颜色,体重等。


class PetClass:
    def __init__(self, pet_name, pet_color,pet_weight):
        self.name = pet_name
        self.color = pet_color
        self.weight = pet_weight

    def info(self):
        return "{},颜色:{},体重:{}".format(self.name,self.color,self.weight)


p_cat = PetClass("猫","黑色","5KG")
print(p_cat.info())
# 其他宠物自行定义即可

:( 这是没有把问题写完吗?

你这列举了好多事物,是想把它们封装为类吗?望采纳。