Kodewick
Start learning →
Starter←→0 / 80

Cinema sign

#057StarterClassesStrings3 min

The sign outside the cinema shows each film's title and year. Write __str__ for Movie so that str(movie) gives 'Cloud Cats (2021)': the title, a space, and the year in brackets.

Examples
movie_label("Cloud Cats", 2021)→'Cloud Cats (2021)'
movie_label("Night Bus", 1999)→'Night Bus (1999)'
main.py
class Movie:
    def __init__(self, title, year):
        self.title = title
        self.year = year

    def __str__(self):
        # your code here: return the title with the year in brackets (instead of return "")
        return ""


def movie_label(title, year):
    movie = Movie(title, year)
    return str(movie)
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.