---
id: 6842c3eee327042f1da17b89
title: Step 6
challengeType: 20
dashedName: step-6
---

# --description--

Create an `if` statement. For its condition, use the `not` operator to negate `is_sequence`. Within the `if` statement, print `Invalid format: expected a list or tuple.` and return `False`.

# --hints--

You should create an `if` statement within your `validate` function.

```js
({ test: () => runPython(`
assert _Node(_code).find_function("validate").find_ifs()[0]
`) })
```

Your `if` statement should have `not is_sequence` as its condition.

```js
({ test: () => runPython(`
assert _Node(_code).find_function("validate").find_ifs()[0].find_conditions()[0].is_equivalent("not is_sequence")
`) })
```

You should print `Invalid format: expected a list or tuple.` inside your `if` statement.

```js
({ test: () => runPython(`
assert _Node(_code).find_function("validate").find_ifs()[0].find_bodies()[0].has_call("print('Invalid format: expected a list or tuple.')")
`) })
```

You should return `False` at the end of your `if` statement.

```js
({ test: () => runPython(`
_if_body = _Node(_code).find_function("validate").find_ifs()[0].find_bodies()[0]
_p_statement = "print('Invalid format: expected a list or tuple.')"

if not _if_body.has_call(_p_statement):
  assert _if_body[-1].is_equivalent("return False")
else:
  assert _if_body.is_ordered(_p_statement, "return False")
`) })
```

# --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--
def validate(data):
    is_sequence = isinstance(data, (list, tuple))
    
--fcc-editable-region--
```
