FAQ: Creating Dictionaries - Make a Dictionary

This community-built FAQ covers the “Make a Dictionary” exercise from the lesson “Creating Dictionaries”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science

FAQs on the exercise Make a Dictionary

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

2 posts were split to a new topic: Shouldn’t the solution match the language to the words?


This answer is broken; my answer is correct. Not only that, but the following should also be correct:
translations = {
‘mountain’: ‘orod’,
‘bread’: ‘bass’,
‘friends’: ‘mellon’,
‘horse’: ‘roch’
}

But above code is also not recognized as being correct. Is there a way to make it so that it can be identified as a valid answer?

The screen shot shows stylized quotes. This happens when we copy code from a post then paste it into the LE editor. Go through the code in the editor and replace with standard quotes.

2 Likes

My code is this
translations = {“mountain”: “orod”, “bread”: “bass”, “friend”: “melon”, “horse”: “roch”}
but it says
Expected dictionary to be: {‘mountain’: ‘orod’, ‘bread’: ‘bass’, ‘friend’: ‘mellon’, ‘horse’: ‘roch’}

Is there a difference in using " and ’

Hey, @olufemioluranti there isn’t a difference, both are used for strings.

But generally, double quotes " " are used for string representation and single quotes ’ ’ are used for regular expressions or dictionary keys. Hence both single quote and double quotes depict string in python, but it’s sometimes our need to use one type over the other.

You wrote 'melon' instead of the expected 'mellon'.

2 Likes