Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q13 of 15
Python - Input and Output
What will be the output of this code?
print("Hello\nWorld\t!")
AHello\nWorld\t!
BHello World !
CHello World !
DHello World !
Step-by-Step Solution
Solution:
  1. Step 1: Interpret escape sequences in the string

    \n creates a new line, so "Hello" and "World" appear on separate lines. \t adds a tab space before the exclamation mark.
  2. Step 2: Visualize the output

    The output shows "Hello" on the first line, then "World" followed by a tab space and "!" on the second line.
  3. Final Answer:

    Hello World ! -> Option C
  4. Quick Check:

    \n = new line, \t = tab space [OK]
Quick Trick: \n breaks line, \t adds spaces like tab [OK]
Common Mistakes:
MISTAKES
  • Printing escape sequences literally instead of interpreting
  • Ignoring tab space effect
  • Confusing \n with space

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes