/
nk1383
/
oop
Обзор
Документация
Войти
/
nk1383
/
oop
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
second.py
22 строки
736 B
Анастасия Ковалевич
upload files
24 окт 2025, 16:03
24 окт 2025, 16:03
210e36c
Код
Авторство
О чём код?
class Book: def __init__(self, title, author, year): self.title = title self.author = author self.year = year def info(self): return f'Title{self.title},author{self.author},year{self.year}' class Ebook(Book): def __init__(self, title: str, author: str, year: int, format: str): self.format = format super().__init__(title, author, year) def info(self): return super().info()+ f', format:{self.format}' book = Book('Гарри Поттер', 'Дж. Роулинг', 1997) ebook = Ebook('Гарри Поттер и Философский камень', 'Дж. Роулинг', 1997, 'PDF') print(book.info()) print(ebook.info())