---
id: 684ed67f4c678896445f973f
title: Step 22
challengeType: 20
dashedName: step-22
---

# --description--

The `**` operator can be used to unpack the elements in a dictionary and pass them as keyword arguments in a function call:

```py
def sum(a, b, c):
    return a + b + c
nums = {'a': 2, 'b': 4, 'c': 1}

print(sum(**nums)) # 7
```

In the example above, `sum(**nums)` is equivalent to `sum(a=2, b=4, c=1)`.

At the bottom of your code, print the result of calling the `find_invalid_records` function. For its arguments, use the `**` operator to unpack `medical_records[0]`.

# --hints--

You should print `find_invalid_records(**medical_records[0])`.

```js
({ test: () => runPython(`
assert _Node(_code).has_call("print(find_invalid_records(**medical_records[0]))")
`) })
```

# --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',
    }
]

def find_invalid_records(
    patient_id, age, gender, diagnosis, medications, last_visit_id
):
    constraints = {
        
    }
    return constraints

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
    key_set = set(
        ['patient_id', 'age', 'gender', 'diagnosis', 'medications', 'last_visit_id']
    )

    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 set(dictionary.keys()) != key_set:
            print(
                f'Invalid format: {dictionary} at position {index} has missing and/or invalid keys.'
            )
            is_invalid = True

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

validate(medical_records)
--fcc-editable-region--

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