---
id: 6846a9d1f115c1de0d357778
title: Step 15
challengeType: 20
dashedName: step-15
---

# --description--

To test the second conditional statement, add two items of your choice that are not dictionaries at the end of the `medical_records` list. You should see two validation messages printed to the terminal.

# --hints--

You should add two items of your choice that are not dictionaries at the end of the `medical_records` list.

```js
({ test: () => runPython(`
assert not isinstance(medical_records[-1], dict)
assert not isinstance(medical_records[-2], dict)
`) })
```

# --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--
]

def validate(data):
    is_sequence = isinstance(data, (list, tuple))

    if not is_sequence:
        print('Invalid format: expected a list or tuple.')
        return False
        
    is_invalid = False

    for index, dictionary in enumerate(data):
        if not isinstance(dictionary, dict):
            print(f'Invalid format: expected a dictionary at position {index}.')
            is_invalid = True

    if is_invalid:
        return False
    print('Valid format.')
    return True

validate(medical_records)
```
