Sobes.tech
Intern — Middle

Класс Book: методы установки и получения данных книги

livecode

Task condition

It is necessary to write a class Book that stores information about a book: title, author, and year of publication. You need to implement functions that allow setting these fields, as well as a function that returns the full information about the book in a convenient form (for example, as a dictionary or string).

class Book:
    def __init__(self):
        self.title = ""
        self.author = ""
        self.year = None

    # Methods for setting and getting information
    ...