---
id: 68af278a60e009597dd861ea
title: Step 10
challengeType: 20
dashedName: step-10
---

# --description--

The `MediaCatalogue` class needs a method to add media items to the catalogue. Create an `add` method that accepts an item `media_item` and appends it to the `items` list.

# --hints--

Your `MediaCatalogue` should have an `add` method.

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

Your `add` method should have two parameters: `self` and `media_item`.

```js
({
  test: () => runPython(`assert _Node(_code).find_class("MediaCatalogue").find_function("add").has_args("self, media_item")`)
})
```

Your `add` method should append the item passed to it to the `items` attribute.

```js
({
    test: () => runPython(`
    _catalogue = MediaCatalogue()
    _catalogue.add("first")
    assert _catalogue.items == ["first"]
    _catalogue.add("second")
    assert _catalogue.items == ["first", "second"]
    `)
})
```

# --seed--

## --seed-contents--

```py
class Movie:
    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}'
--fcc-editable-region--
class MediaCatalogue:
    def __init__(self):
        self.items = []

    
--fcc-editable-region--
try:
    movie1 = Movie('The Matrix', 1999, 'The Wachowskis', 136)
except ValueError as e:
    print(f'Validation Error: {e}')
```
