---
id: 68af273960e009597dd861e2
title: Step 2
challengeType: 20
dashedName: step-2
---

# --description--

You want a readable display for debugging and printing. Create a `__str__` method that returns a string with the format `title (year) - duration min, director` (where `title`, `year`, `duration`, and `director` should be replaced with the values of the corresponding attributes) so that printing a movie gives a nice summary.

# --hints--

Your `Movie` class should have a `__str__` method.

```js
({
  test: () => runPython(`assert _Node(_code).find_class("Movie").has_function("__str__")`)
})
```

Your `__str__` method should return a string in the format `title (year) - duration min, director`, where `title`, `year`, `duration`, and `director` should be replaced with the values of the corresponding attributes.

```js
({
    test: () => runPython(`
    import io
    import sys
        
    captured_output = io.StringIO()
    sys.stdout = captured_output
        
    movie1 = Movie('The Matrix', 1999, 'The Wachowskis', 136)
    print(movie1)
        
    sys.stdout = sys.__stdout__
    output = captured_output.getvalue()
        
    assert "The Matrix (1999) - 136 min, The Wachowskis" in output
    `)
})
```

# --seed--

## --seed-contents--

```py
--fcc-editable-region--
class Movie:
    def __init__(self, title, year, director, duration):
        self.title = title
        self.year = year
        self.director = director
        self.duration = duration

    
--fcc-editable-region--
```
