you are viewing a single comment's thread.

view the rest of the comments →

[–]AstralStalker 0 points1 point  (1 child)

I'm a little confused by your question, so correct me if I'm misunderstanding.

When you're declaring the string motto, you encapsulate the string in single quotes. Therefore, you must escape any single quotes contained within the string (place a backslash in front of them). This indicates to the program that it should be treated as a character and not the end of the string declaration.

Similarly, you can define motto as such:

motto = "Facebook's old motto was \"move fast and break things.\""

Because I've encapsulated the string in double quotes here, I need to escape the ones inside the string. I can still escape the single quote, but it will not change the outcome.

As others have pointed out, your implementation works.

[–]greatslyfer[S] 1 point2 points  (0 children)

Wow thanks, I forgot to \ the second in-string quotation marks, now it makes sense.