Challenge - 5 Problems
Multi-line Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of multi-line string with triple quotes
What is the output of this Python code?
Python
text = '''Hello World Python''' print(text)
Attempts:
2 left
💡 Hint
Triple quotes preserve new lines inside the string.
✗ Incorrect
Triple quotes allow writing strings on multiple lines. The \n inside the string is interpreted as a new line, so print outputs three lines.
❓ Predict Output
intermediate2:00remaining
Output of multiple print statements
What will be printed by this code?
Python
print('Line 1') print('Line 2') print('Line 3')
Attempts:
2 left
💡 Hint
Each print outputs a new line by default.
✗ Incorrect
Each print statement outputs text followed by a new line, so the output is three lines with one line each.
❓ Predict Output
advanced2:00remaining
Output of multi-line string with escape sequences
What is the output of this code?
Python
text = """First line Second line Tabbed Third line""" print(text)
Attempts:
2 left
💡 Hint
Escape sequences like \n and \t are interpreted inside triple quotes.
✗ Incorrect
The \n creates new lines and \t adds a tab space in the output.
🔧 Debug
advanced2:00remaining
Identify the error in multi-line string usage
What error does this code raise?
Python
text = '''This is a multi-line string without closing quotes print(text)
Attempts:
2 left
💡 Hint
Check if all quotes are properly closed.
✗ Incorrect
The triple quotes are not closed, so Python raises a SyntaxError.
🧠 Conceptual
expert2:00remaining
How many lines does this multi-line string contain?
How many lines will the variable 'text' contain after this code runs?
Python
text = '''Line1 Line2 Line4'''
Attempts:
2 left
💡 Hint
Count all lines including empty ones created by \n.
✗ Incorrect
The string has Line1, Line2, an empty line (because of \n\n), and Line4, so 4 lines total.