class Pet:
def __init__(self, name, animal_type, age):
self.__name = name
self.__animal_type = animal_type
self.__age = age
def set_name(self, name):
self.__name = name
def set_animal_type(self, animal_type):
self.__animal_type = animal_type
def set_age(self, age):
self.__age = age
def get_name(self):
return self.__name
def get_animal_type(self):
return self.__animal_type
def get_age(self):
return self.__age
def display_details(self):
return "Pet {} is a {}, and it is {} years old".format(self.__name, self.__animal_type,
self.__age)
//问题出在这里^
name = input("Enter pet name:")
animal_type = input("Enter pet type:")
age = int(input("Enter age of pet:"))
Pet(name, animal_type, age)
// im试图显示display_details下的句子,但我在输出中看不到它// lllllllllllllllllllllllllllllllllllllllllllllllllllll