Build a Medical Data Validator

I keep Getting indentation error , works fine in Spyder6

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

# 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

Please share a link to the challenge and format your code to be readable

When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

If you use the Help button this is done automatically for you when you create a topic

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

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