Build a Medical Data Validator - Step 8

Tell us what’s happening:

Trying to add that enumerate loop always (i tried rearranging it) gives me indentation error, but it runs fine in Spyder6

Your code so far

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 validate(data):
    is_sequence = isinstance(data, (list, tuple))

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

# User Editable Region

    # Define a sample list of data
data  = {'name': 'John', 'age': 33}

# Use enumerate to iterate over the list with index and value
    for index, dictionary in enumerate(data):
    # For now, just pass (do nothing)
    
        pass
    return True
 
 
 


# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Medical Data Validator - Step 8

this is not indented, meaning outside the function, things after this indented give the error

please double check the indentation and if you need reset the step and try again

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