CS Path "Chapter" 5: Creating Dictionaries Quiz


#1

Hey guys, I’m new to the forum or community if you will. I’ve been chugging along the CS Pro path and encountered what might possibly be an error or mis-clarification on the quiz for dictionaries.

Link to quiz:
https://www.codecademy.com/paths/computer-science/tracks/cspath-python-objects/modules/cspath-python-dictionaries/quizzes/creating-dicts

The question asks: "What is the line of code to initialize an empty dictionary called thesaurus?"

I was surprised to find that none of the answers included just setting empty dict thesaurus as just thesaurus = {}. According to the lessons this is how it was taught and I’ve never seen it end with a semi-colon, unless using a semi-colon could call for another argument? I tried searching it up as well as to how to initialize empty dictionaries but they all use the format of x = {}, less the semi-colon.

Any help with be appreciated, thanks a bunch in advance!
(also if this is posted in the wrong section or area I apologize)

Picture down below for reference:


#2

Hi @nguyenw

In Python, a semicolon can be used to denote the end of a statement, but that is not often done because ending the line is sufficient to accomplish that. Occasionally you may see semicolons used to separate several short statements placed on the same line, but this tends to make the code harder to read.

print("Hello, semicolon!"); print("Hello, world!")

Output …

Hello, semicolon!
Hello, world!

Why the author of this quiz placed semicolons at the ends of the lines is a mystery to me, since they are not needed here.


#3

Thank you for answering this @appylpye! It makes sense to me now.

So I guess I’m not crazy after all haha, it’s odd of them to offer that especially having not taught it in the curriculum whatsoever.

Cheers