Cater Waiter exercise variable definition missing

Not sure if the error was reported already, but the variable just_berries which is used in the example code doesn’t seem to be defined anywhere in the exercise.

I would also replace all the occurrences of a double hyphen (--) with an en dash () for a more clean and formal appearance. Example sentence:

image

And there’s a few more sentences along the text with double hyphen, including task 1 down in the instructions section.

There also seems to be a two copies of a dish in the variable example_dishes:

{'mango powder', 'oil', 'salt', 'cardamom powder', 'fresh red chili', 'sugar', 'fresh ginger', 'turmeric', 'red chili powder', 'curry leaves', 'garlic paste', 'mustard seeds', 'vinegar', 'mashed potatoes', 'garam masala', 'mangoes', 'nigella seeds', 'clove powder', 'serrano chili', 'cumin powder', 'onion', 'water', 'chickpea flour', 'coriander seeds', 'turmeric powder', 'hing', 'coriander powder', 'cinnamon powder', 'cilantro', 'garlic'}

Task 3 (Categorize Dishes) instructions state that the function categorize_dish expects a string and a set as its arguments, but the function description contradicts that.

I suspect just_berries is a typo and should be berries from the previous line of code. Bethany the Python maintainer is pretty active so she should get back to you about that more definitively and the style question regarding en dash as well.

1 Like

Hi @YasirA :wave:

Thanks for opening a post for these issues. I’ve addressed them in PR 3780, which should be merged to the website shortly.

However, I do want to address the double hyphens here. They were never intended to be an endash. Rather, the intent was for an emdash:

It is primarily used in places where a set of parentheses or a colon might otherwise be used, and it can also show an abrupt change in thought (or an interruption in speech) or be used where a full stop (period) is too strong and a comma is too weak

Since &emdash; (HTML emdash) in the middle of markdown text often fails to render, and there is incomplete font support for U+2014 (unicode emdash) / ALT + 0151 (extended ascii emdash) across fonts, I decided to use a double hyphen, which is considered a valid typographic substitute (from Merriam Webster Online):

An em dash or pair of dashes often sets off illustrative or amplifying material introduced by such phrases as for example , namely , and that is , when the break in continuity is greater than that shown by a comma, or when the dash would clarify the sentence structure better than a comma.

We’re going to give it a go with this PR, but I reserve the right to revert the change if it doesn’t render well on the website.

For the purposes of the example (since it is used nowhere else in the exercise), having two dishes/sets that are identical in the example_dishes list doesn’t change the intersection outcome, so I don’t think it needs to be changed at this time.

Please let us know if you have further questions or issues. :slightly_smiling_face:

3 Likes

Thanks for implementing the changes.

I just reviewed them, and noticed that the formatting of the first paragraph got corrupted somehow. Note the word “unordered” in particular.

Em dash is fine too, but as far as I know, there shouldn’t be spaces around it when used in place of colons or parentheses. From the same article on Wikipedia:

According to most American sources (such as The Chicago Manual of Style) and some British sources (such as The Oxford Guide to Style), an em dash should always be set closed, meaning it should not be surrounded by spaces. But the practice in some parts of the English-speaking world, including the style recommended by The New York Times Manual of Style and Usage for printed newspapers and the AP Stylebook, sets it open, separating it from its surrounding words by using spaces or hair spaces (U+200A) when it is being used parenthetically. The AP Stylebook rejects the use of the open em dash to set off introductory items in lists. However, the “space, en dash, space” sequence is the predominant style in German and French typography. (See En dash versus em dash below.)

Just saying.

I changed the formatting in the first paragraph, but it looks like a space crept in for at least one of the files. I’ll fix that.

As far as the setting, Wikipedia goes on to say that there is not full agreement. While I do generally follow the Chicago Manual of Style when it comes to things like the Oxford Comma, here I disagree.

But thanks for your feedback.