This seems straight forward to me and the test output is showing exactly the desired text. What is my error?
Your code so far
class Movie:
# User Editable Region
def __init__(self, title, year, director, duration):
if not title.strip():
raise ValueError('Title cannot be empty')
if year < 1895:
raise ValueError('Year must be 1895 or later')
if not director.strip():
raise ValueError('Director cannot be empty')
if duration < 0:
raise ValueError('Duration must be positive')
self.title = title
self.year = year
self.director = director
self.duration = duration
# User Editable Region
def __str__(self):
return f'{self.title} ({self.year}) - {self.duration} min, {self.director}'
movie1 = Movie('The Matrix', 1999, 'The Wachowskis', -136)
print(movie1)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0
def \__init_\_(self, title, year, director, duration):
if not title.strip():
raise ValueError('Title cannot be empty')
if year < 1895:
raise ValueError('Year must be 1895 or later')
if not director.strip():
raise ValueError('Director cannot be empty')
if duration < 0:
raise ValueError('Duration must be positive')
self.title = title
self.year = year
self.director = director
self.duration = duration
def \__str_\_(self):
return f'{self.title} ({self.year}) - {self.duration} min, {self.director}'
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge.
The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.