Build a Medical Data Validator - Step 44

Tell us what’s happening:

No matter what i do, it’s still showing ‘You should print Unexpected format ‘: ’ at position . (where , , and should be replaced by the current key, value and index) inside your for loop.’

Your code so far



        invalid_records = find_invalid_records(**dictionary)

# User Editable Region

        for key, val in invalid_records:
            print(f"Unexpected format '{key}: {val}' at position {index}.")
            is_invalid = True

    if is_invalid:
        return False

# User Editable Region

    print('Valid format.')
    return True

validate(medical_records)

Your browser information:

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

Challenge Information:

Build a Medical Data Validator - Step 44

Do key and val both exist inside invalid_records? Find out by changing keys or values inside medical_records to be invalid. Then log invalid_records. What does it contain? What type of data structure is it?

1 Like

Yes, both key and val exist inside invalid_records.

When I make some values in medical_records invalid and print invalid_records, I get something like:

[('age', False), ('patient_id', False)]

did you made other changes to the code? because that is not what is expected
can you post your updated code?

In the find_invalid_records function, the return statement was changed.

Before:

return [key for key, value in constraints.items() if not value]

After:

return [(key, value) for key, value in constraints.items() if not value]

you can’t do that, please use the reset button, and work on the loop only

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