1/9 Followed the Example and Was Wrong


#1

I had copied the format it showed as a reminder of how to create dictionaries, but it kept flagging it and was showing the colon as the culprit. I could not figure out what was wrong with my code and finally gave up and let it give me the code. All it changed was it added a space before each colon. However, there are no spaces before the colons in the example image. Is the example wrong?


#2

Sounds like you didn’t follow the example, keep in mind that python can’t tell you where your mistake is, it’ll tell you where your code could no longer be interpreted in any way which may be further ahead than the mistake itself. If it pointed at a colon then it likely expected something else first, like a comma between entries.

I wouldn’t put spaces there, but it makes no difference to Python (style guidelines wouldn’t agree though)


#3

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