---
id: 6842ba0086201089ea268c92
title: Step 5
challengeType: 20
dashedName: step-5
---

# --description--

Following the same structure you used in the previous steps, the `medical_records` list has been filled up for you with other patients' data. Feel free to take a look at it.

Next you'll start to write the function to validate the data set. Create a function named `validate` with a single parameter `data`.

You want to ensure that your data is either a list or a tuple. Therefore, within the `validate` function, declare a variable named `is_sequence` and assign it a call to `isinstance`. Pass in `data` as the first argument and a tuple containing `list` and `tuple` as the second argument.

# --hints--

You should have a function named `validate`.

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

Your `validate` function should have a single parameter `data`.

```js
({ test: () => runPython(`
assert _Node(_code).find_function("validate").has_args("data")
`) })
```

You should have a variable named `is_sequence` within your `validate` function.

```js
({ test: () => runPython(`
assert _Node(_code).find_function("validate").has_variable("is_sequence")
`) })
```

You should assign `isinstance(data, (list, tuple))` to your `is_sequence` variable.

```js
({ test: () => runPython(`
_cond = _Node(_code).find_function("validate").find_variable("is_sequence")
assert _cond.is_equivalent("is_sequence = isinstance(data, (list, tuple))") or _cond.is_equivalent("is_sequence = isinstance(data, (tuple, list))")
`) })
```

# --seed--

## --seed-contents--

```py
medical_records = [
    {
        'patient_id': 'P1001',
        'age': 34,
        'gender': 'Female',
        'diagnosis': 'Hypertension',
        'medications': ['Lisinopril'],
        'last_visit_id': 'V2301',
    },
    {
        'patient_id': 'p1002',
        'age': 47,
        'gender': 'male',
        'diagnosis': 'Type 2 Diabetes',
        'medications': ['Metformin', 'Insulin'],
        'last_visit_id': 'v2302',
    },
    {
        'patient_id': 'P1003',
        'age': 29,
        'gender': 'female',
        'diagnosis': 'Asthma',
        'medications': ['Albuterol'],
        'last_visit_id': 'v2303',
    },
    {
        'patient_id': 'p1004',
        'age': 56,
        'gender': 'Male',
        'diagnosis': 'Chronic Back Pain',
        'medications': ['Ibuprofen', 'Physical Therapy'],
        'last_visit_id': 'V2304',
    }
]

--fcc-editable-region--

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