3 AnswersNew Answer
The lesson is teaching the use of escape characters when printing strings. In the sentence example there a 5 quotation marks. The outside quotation marks are meant to encapsulate the string sentence. The inner quote marks are for the English language syntax. Python will try to encapsulate the string from the first pair of quote marks, so to prevent this, an escape character is used (\) to tell Python to bypass the following quote mark. This continues to happen until a quote mark is encountered which has not been escaped. The string is then encapsulated. Try printing 'Brian's', Then try printing 'Brian\'s' You will see the difference in the output
"He's very naughty." 'He\'s very naughty.' See the difference? Another example: 'She said, "Hello!" ' "She said, \"Hello!\" "
it was in the strings topic, i dnt understand if i have to remove \ from first line or i have to use \ where i will use 's ?