FAQ: Learn Python: Syntax - Print

This community-built FAQ covers the “Print” 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 Print

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 posts were split to a new topic: How can I ask the user for input?

2 posts were split to a new topic: How can I skip or jump to a new line while printing?

2 posts were split to a new topic: How can I use quotes inside of a string?

Why do we need to put up the input message in brackets?
what is the reason behind using () in the print statement?

That’s part of the syntax for the standard way to call a function:

function(arguments)

You’ll come across this with a bit more information as you progress through the lessons.

what if you need to show possession inside the string, for example, if i wanted to say, “This is Fred’s ball” how would i not incur a syntax error for the 's

In most cases you can use the escape character \ to include characters which would otherwise have a special meaning in string literals. For quotes you could rely on internal characters that are different from the outer quotes used to mark the string but be careful about overcomplicating the code since it can become very hard to read and understand:

print("Where's my porridge?")
print("'This porridge is too hot!', said the hairy bear.")
# triple quotes allow other options but can potentially introduce even more complexity.
print('''"Inconceivable!", exclaimed the museli, "I'll not tolerate such slander from a hairy bear."''')
1 Like