Bird
0
0

What does the escape character \n do in a Python string?

easy📝 Conceptual Q11 of 15
Python - Input and Output
What does the escape character \n do in a Python string?
AEnds the string
BInserts a tab space
CPrints a backslash character
DStarts a new line in the output
Step-by-Step Solution
Solution:
  1. Step 1: Understand escape characters

    Escape characters are special sequences starting with a backslash that change how text is displayed.
  2. Step 2: Identify the effect of \n

    The sequence \n means a new line, so it moves the cursor to the next line when printing.
  3. Final Answer:

    Starts a new line in the output -> Option D
  4. Quick Check:

    \n = new line [OK]
Quick Trick: Remember \n means new line, like pressing Enter [OK]
Common Mistakes:
MISTAKES
  • Confusing \n with tab space
  • Thinking \n prints literally as \n
  • Mixing up \n with backslash

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes