livepython.net

14. Python Program to Print Escape Sequences as Text

EasyEscape sequences

Overview

In this exercise, you will learn how to print special escape sequences literally in Python. This question emphasizes proper escaping of backslash characters in strings.

Problem Statement

Write a Python program that prints the following text exactly as shown using a single print() function:

To break the line, use \n and for tabs use \t

Input

  • No input is required.

Output

The program should output the following:

To break the line, use \n and for tabs use \t

Pay close attention to how special characters are represented in strings!

Learn this firstChapter 2 · Escape Sequences in Python: \n, \t and More
solution.py
# write your code here

EXPECTED OUTPUT

1To break the line, use \n and for tabs use \t

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.