FAQ: Learn Python: Syntax - Multi-line Strings


#1

This community-built FAQ covers the “Multi-line Strings” exercise from the lesson “Learn Python: Syntax”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Multi-line Strings

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


#2

Is there any way to prevent the closing apostrophes from populating when opening the multi-line string?


#3

I’m running into a problem. I keep trying to put in “”", but it does not allow me to. I can only put in “” or “”"""". There is a SyntaxError when I run either of these.

Assign the string here

to_you = ‘’’’’’
Stranger, if you passing
meet me and desire to
speak to me, why
should you not speak to me?
An why should I not speak
to you?’’’’’’
print(to_you)


#4

I’m not sure why would you like to do that? It saves you time from writing them at the end.


#5

The problem you have is with these:
’’’’’’
The look different from the normal ones:
“”"

Here’s the difference in CodeAcademy:

Please copy this and try it at your end:

# Assign the string here
to_you = """Stranger, if you passing meet me and desire to speak to me, why
  should you not speak to me?
And why should I not speak to you?"""
print(to_you)

It should work.