Build a Medical Data Validator - Step 44

Tell us what’s happening:

i tried everything i learn so far but i couldn’t get pass this one. its still showing invalid_records not define.
please help

Your code so far


# User Editable Region


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

# 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/143.0.0.0 Safari/537.36 Edg/143.0.0.0

Challenge Information:

Build a Medical Data Validator - Step 44

Hi @muhdrayyan

Is there any error message in the console?

Happy coding

yes its saying, “ ‘invalid_records’ is not defined “

i got it now.

thanks :blush:

1 Like

really your code ran for me

thanks

i was running the loop like key, value in invalid_records, i had forgotten that i have to use invalid_records only. So i used your way

i was having trouble with this step. and i changed {val} to {dictionary[key]} like you did, and it worked. but i don’t understand why. isn’t {dictionary[key]} an integer?

why do you think it is an integer?

sometimes it is, sometimes it isn’t, if you look at the object you should see that it can be any value

right, i got confused for a moment. but i still don’t understand why {value} changed with {dictionary[key]}.

do you understand what dictionary is? do you remember what the dictionary[key] syntax does?

do you understand what we want to communicate with this loop?

i know what dictionary is. but i don’t understand whether what dictionary[key] syntax does nor what does the loop for.

if you don’t know what the dictionary[key] syntax does you should review how to work with dictionaries

the loop is to print infos about each invalid key/value pair found in the dictionary being analysed