Q on apostrophe correction


#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/strings--console-output/exercises/escaping-characters?action=lesson_resume

<In what way does your code behave incorrectly? Include ALL error messages.>

In editing the following text:

'This isn’t flying, this is falling with style!'
I understand that the apostrophe in the word isn’t is a problem;
why are the apostrophes at the start and end of the full text not problems as well?

```python

Replace this line with your code.

<do not remove the three backticks above>

#2

The apostrophes at the end at quotation marks. The apostrophe in the contraction needs to be escaped.

'This isn\’t flying, this is falling with style!'

We can get around this by using double quotes to wrap the sentence.

"This isn’t flying, this is falling with style!"

#3

let me do a better job of asking:
In editing the following text: ‘This isn’t flying, this is falling with style!’, I understand that the apostrophe in the word is a problem, and I can correct it,
why are the apostrophes at the start and end of the full text not a problem?


#4

Because they are quotation marks. Strings may be quoted in single or double quotes.

What happens when we start a string with a single quote and then use an apostrophe in the text? The string terminates and everything following looks like an identifier to the interpreter.


#5

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