"Build a Medical Data Validator" Python project, Step 44

Не розумію в чому проблема. “Build a Medical Data Validator” Python project, Step 44

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

Що не так. Чому не працює код?

Please post a link to the challenge. Thank you.


I’ve edited your post to improve the readability of the code. 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 (').

for index, dictionary in enumerate(data):

You are writing your code inside this loop, so you already have the index available.

Please make sure your f-string matches the text in the instructions, including the spacing.

```for key in invalid_records:

        val = dictionary\[key\]

        print(f"Unexpected format'{key}:{val}'at position {index}")

        is_invalid = True

Витрачено пів дня не зрозуміло на що.

Does the spacing in your f-string match the text in the instructions?

print(Unexpected format '<key>:<val>' at position <index>.)

OK. Code with this string format also doesn’t work

I don’t see a space after the word ‘format’ or after the colon or after the last single quote.

Again, here’s the string from the instructions. Try copying and pasting it in your code and just replacing the angle brackets with curly braces.

Unexpected format '<key>: <val>' at position <index>.

Thanks for the tip. Finally I found the problem. There were several of them. Little things that take up a lot of time and discourage further learning.

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