Professional Documents
Culture Documents
Sunod Sunod Na Yan
Sunod Sunod Na Yan
@property
def title(self):
return self._title
@property
def author(self):
return self._author
@property
def pages(self):
return self._pages
@title.setter
def title(self, new_title):
self._title = new_title
@author.setter
def author(self, new_author):
self._author = new_author
@pages.setter
def pages(self, new_pages):
self._pages = new_pages
print(my_book.title)
print(my_book.author)
print(my_book.pages)
class Book:
def __init__(self, title: str, author: str, pages: int):
self.__title = title
self.__author = author
self.__pages = pages
def get_title(self):
return self.__title
class EBook(Book):
def __init__(self, title, author, pages):
super().__init__(title, author, pages)
def get_format(self):
return self.get_title().split(".")[-1]
class AbstractBook:
def display_details(self):
pass
class Book(AbstractBook):
def __init__(self, title: str, author: str, pages: int):
self.__title = title
self.__author = author
self.__pages = pages
def get_title(self):
return self.__title
def display_details(self):
return f"""
Title: {self.__title}
Author: {self.__author}
Pages: {self.__pages}
"""
class EBook(Book):
def __init__(self, title, author, pages):
super().__init__(title, author, pages)
def get_format(self):
return self.get_title().split(".")[-1]