Hello appylpye,
I had done the same answer previously and did it again after your email showing instruction but still showing syntax error.
Vikram
Hello appylpye,
I had done the same answer previously and did it again after your email showing instruction but still showing syntax error.
Vikram
Please copy and post all of the code that was in the editor when the SyntaxError
occurred. Without our seeing that code, we cannot help you determine the cause of the problem.
Hello appylpye,
Thanks for your prompt reply. I corrected my error in editor page. I was typing print before caesar = “Graham”. Now further exercise Escaping characters Lesson 2 . ‘There’ s a snake in my boot !’ I tried several times but it shows syntax error. Also in editor page line 3 ‘This isn’t flying, this is falling with style!’ also shows syntax error. Line 3 is already printed in the lesson. Could you help me through?
You are given this:
'This isn't flying, this is falling with style!'
It raises a SyntaxError
because the single quote character within that attempt at a string is the same character as the single quote characters that are meant to delimit the beginning and the end of it. Python interprets that single quote inside as a delimiter that terminates the string, however, it then finds that there are characters following the quote that don’t make syntactic sense.
One way to fix this is to place a \
character just before the single quote that is within the purported string. This indicates to the Python interpreter that the single quote is not a delimiter, but is instead to be included as part of what then becomes a genuine string. Be sure to use a backslash rather than a forward slash.
Following is a shorter, but similar example.
This doesn’t qualify as a string:
'isn't'
This does qualify as a string:
'isn\'t'
Try out the exercise, and if you have trouble, post the code here, following the specifications for formatting code discussed in How to ask good questions (and get good answers).
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.