# Build a Medical Data Validator - Step 19

**URL:** <https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [September 3, 2026, 7:37pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384 "2026-09-03T19:37:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![abeehakashan2008](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abeehakashan2008/32/421108_2.png) [@abeehakashan2008](https://forum.freecodecamp.org/u/abeehakashan2008)\
**Post date:** [September 3, 2026, 7:37pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/1 "2026-09-03T19:37:38Z")

</div>

### Tell us what’s happening:

I’m stuck at step 19, even tho it tried everything.  
I did comment out the line of age 34 but it’s still not working.

### Your code so far

```py
# User Editable Region
medical_records = [
    {
        'patient_id': 'P1001',
        # 'age': 34,
        'gender': 'Female',
        'diagnosis': 'Hypertension',
        'medications': ['Lisinopril'],
        'last_visit_id': 'V2301'
    }
]

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)
# User Editable Region

```

### Your browser information:

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36`

### Challenge Information:

Build a Medical Data Validator - Step 19

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/python-v9/workshop-medical-data-validator/step-19)**
>
> Learn to Code — For Free

GitHub Link: [freeCodeCamp/curriculum/challenges/english/blocks/workshop-medical-data-validator/6846ba7ef391f007fcc37688.md at main · freeCodeCamp/freeCodeCamp · GitHub](https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/workshop-medical-data-validator/6846ba7ef391f007fcc37688.md)

---

<div class="post-metadata">

**Author:** ![Teller](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/teller/32/412338_2.png) [@Teller](https://forum.freecodecamp.org/u/Teller)\
**Post date:** [September 3, 2026, 7:49pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/2 "2026-09-03T19:49:29Z")

</div>

Welcome to the forum @abeehakashan2008

You are not asked to remove any of the records.

Please reset the step and only comment out the `age` line. Do not modify the `medical_records` list by removing any of the dictionaries.

Happy coding

---

<div class="post-metadata">

**Author:** ![abeehakashan2008](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abeehakashan2008/32/421108_2.png) [@abeehakashan2008](https://forum.freecodecamp.org/u/abeehakashan2008)\
**Post date:** [September 3, 2026, 7:55pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/3 "2026-09-03T19:55:07Z")

</div>

thanks, but it is still not working can you write me that line so that i can get help.

---

<div class="post-metadata">

**Author:** ![Teller](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/teller/32/412338_2.png) [@Teller](https://forum.freecodecamp.org/u/Teller)\
**Post date:** [September 3, 2026, 7:57pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/4 "2026-09-03T19:57:49Z")

</div>

Try refreshing the page using CTRL + F5

You correctly commented out the code in your original post.

Happy coding

---

<div class="post-metadata">

**Author:** ![abeehakashan2008](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abeehakashan2008/32/421108_2.png) [@abeehakashan2008](https://forum.freecodecamp.org/u/abeehakashan2008)\
**Post date:** [September 3, 2026, 8:01pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/5 "2026-09-03T20:01:34Z")

</div>

I’m sorry that i’m bothering you… but, It still not worked. I have attached the error pic too.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/9/3/0/930e49bf202d876b7b93c87a95b8397947d6f740.png)

---

<div class="post-metadata">

**Author:** ![Teller](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/teller/32/412338_2.png) [@Teller](https://forum.freecodecamp.org/u/Teller)\
**Post date:** [September 3, 2026, 8:04pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/6 "2026-09-03T20:04:25Z")

</div>

You should have four dictionaries in `medical_records`, not 1.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/5/3/6/5360da196cd724f9811627f3e662062c307b8186.png)

Make sure to reset the step to restore the seed code.

Happy coding

---

<div class="post-metadata">

**Author:** ![abeehakashan2008](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/abeehakashan2008/32/421108_2.png) [@abeehakashan2008](https://forum.freecodecamp.org/u/abeehakashan2008)\
**Post date:** [September 3, 2026, 8:12pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/7 "2026-09-03T20:12:17Z")

</div>

Thank you so much!  
It works.🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [September 5, 2026, 8:12pm UTC](https://forum.freecodecamp.org/t/build-a-medical-data-validator-step-19/799384/8 "2026-09-05T20:12:43Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
