Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The print function
4. Escaping single quotation marks and apostrophes
Variables
Math in Python
The input function
Summary

Instruction

Perfect! If single quotation marks around strings are never printed, how can you create strings that contain those quotation marks or apostrophes? For instance, how can you show the following?

I'm happy today!

The answer is to use a backslash, also called the escape character. Backlashes are put before special characters. Apostrophes are one example of special characters in Python.

print('I\'m happy today!')

Exercise

Show the following text:

You're studying Python now.

Stuck? Here's a hint!

Use:

print('You\'re studying Python now.')