Вопрос пользователя:
Ответ нейросети:
class Book: def init(self): self.title = "" self.year = 0 self.publisher = "" self.genre = "" self.author = "" self.price = 0.0
def input_data(self):
self.title = input("Enter the title of the book: ")
self.year = int(input("Enter the year of publication: "))
self.publisher = input("Enter the publisher of the book: ")
self.genre = input("Enter the genre of the book: ")
self.author = input("Enter the author of the book: ")
self.price = float(input("Enter the price of the book: "))
def display_data(self):
print("Title:", self.title)
print("Year of publication:", self.year)
print("Publisher:", self.publisher)
print("Genre:", self.genre)
print("Author:", self.author)
print("Price:", self.price)
def get_title(self):
return self.title
def get_year(self):
return self.year
def get_publisher(self):
return self.publisher
def get_genre(self):
return self.genre
def get_author(self):
return self.author
def get_price(self):
return self.price
book1 = Book() book1.input_data() book1.display_data()
print("Title:", book1.get_title()) print("Year of publication:", book1.get_year()) print("Publisher:", book1.get_publisher()) print("Genre:", book1.get_genre()) print("Author:", book1.get_author()) print("Price:", book1.get_price())
Напишите нам, если в вопросе есть ваши персональные данные ([email protected])
Обратите внимание: ответы, предоставляемые искусственным интеллектом, могут не всегда быть точными. Не рассчитывайте на них в критически важных областях, таких как медицина, юриспруденция, финансы или в вопросах, связанных с безопасностью. Для важных решений всегда обращайтесь к квалифицированным специалистам. Администрация сайта не несет ответственности за контент, сгенерированный автоматически.