Double Quote's When Adding a Placeholder 9-12


Hi Everyone!

I just finished lesson 9-12 and my code works and was accepted, but I wanted to use a possessive apostrophe in the dictionary value. When I use the backslash placeholder in front of it, I get a double quote around the output instead of a single quote like it should be. Should I do something different? Is there a way to avoid this?

Thanks in advance! Code follows:

zoo_animals['Rockhopper Penguin'] = 'Lion\'s Den'


{'Atlantic Puffin': 'Arctic Exhibit', 'Rockhopper Penguin': "Lion's Den"}


The surest way to get a single quote in print is to double quote the string containing it. Witness,


Thank you for the reply! I tried that, and I still seem to get double quotes. Tried both:

"Lion\'s Den"


"'Lion\'s Den'"

But if I don't use the apostrophe, it works fine.


Escapement is lost after assignment. Python has no choice but to switch up the outer quotes in order to preserve the inner one.


Ok, thanks for the help!


Escapement is not needed when quotes are already in order.

The single quote is adequately contained in the string.


Sorry, I'm not grasping this and am tearing my hair out a little. I'm not quite sure I understand what you're saying. Essentially, I just want 'Lion's Den' to print out with the single quotes exactly like the previous value 'Arctic Exhibit' did. When I remove the placeholder and apostrophe, it works fine, but when I add the apostrophe it switches to the double quotes. Is it because I'm reassigning the value? If that's the case, is there no way to do it simply?


It is stretching its ability to contain the primitive structure. We need to think backwards from here. And if you are seeking pretty output of structures, then that is entirely another question.


Lol, I'm so new at this, I'm not sure exactly what I'm seeking! I guess I just want to make sure I'm not doing something wrong that's going to cause difficulties when used elsewhere. It didn't throw an error, so I'll be happy and move on.

Thanks for your help!


Right now just focus on the mechanics and the simplicity. 'Elsewhere' is a long ways off from here. But these introductory steps are the way there. Follow them, and hold off long term concerns.