Escaping Characters


#1

The string below is broken. Fix it using the escape backslash!

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

The hint given is :

You can escape the ’ just by adding a ’ before it: '.
There’s another way to fix this problem. Can you think of it?
You cannot pass this exercise with the other methods.

I don’t understand : What exactly is wrong with the code ? Why is it broken ?


#2

Hi @gengyang,

The string has an internal ' mark, and uses the same character as a delimiter. You need to make a correction wherein the string still contains the internal ' character, but without its constituting an error.

See this example of correct code that is provided within the exercise …

'There\'s a snake in my boot!'

Note how the internal ' is handled.


#3

I tried putting a \ in front of the ',

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

, but when I tried to run it, it still doesn’t work … no result, nada.


#4

It seems you did it correctly, then, and it should have passed. What message did you get after submitting it?


#5

This is my code :

The string below is broken. Fix it using the escape backslash!

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

When I clicked “run”, no result at all … no message, nothing at all happens , weird …


#8

The ’ \ ’ doesn’t show up in my code


#9

Refresh the page, and try submitting the correct solution to Codecademy again, using the \ escape character. Use single quotes as delimiters at both ends of the string. Let us know what happens.


#10

Yah, still no results after refreshing weird. Have you tried it on your computer ?


#11

Yes, this is what worked …

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

The only change needed from the original code was to insert the \ character right before the internal ' character. Everything else should be left exactly as it was.


#12

Yup, its the exact same thing I typed in my computer. I even copy and pasted your code directly, but still no result at all. Nothing happens :frowning:


#13

You should report it as bug, then, using the button in the lower left corner of the page …

02 PM

Include information regarding the browser and operating system you are using.


#14

Ok, I reported the bug, waiting for the administrators to review and get back to me


#15

Let us know how it works out.

Meanwhile, anyone else who has encountered the same problem with the corrected string not being accepted, and who has subsequently resolved it, please inform us regarding how you did it.


#16

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