Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q4 of 15
Python - Input and Output
What will be the output of this code?
print("Line1\nLine2\tEnd")
ALine1 Line2 End
BLine1 Line2 End
CLine1 Line2 End
DLine1 Line2 End
Step-by-Step Solution
Solution:
  1. Step 1: Interpret \n and \t in the string

    \n creates a new line, so 'Line2' starts on the next line. \t inserts a tab space before 'End'.
  2. Step 2: Visualize the output

    The output will be:
    Line1
    Line2 End (with tab space before End)
  3. Final Answer:

    Line1
    Line2 End
    -> Option C
  4. Quick Check:

    \n = new line, \t = tab space [OK]
Quick Trick: \n = new line, \t = tab space in output [OK]
Common Mistakes:
MISTAKES
  • Confusing \t with spaces
  • Ignoring \n effect
  • Printing escape characters literally

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes