Challenge - 5 Problems
String Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
โ Predict Output
intermediate2:00remaining
Output of multiline string with escape sequences
What is the output of this Python code?
Python
text = '''Line1\nLine2\tTabbed''' print(text)
Attempts:
2 left
๐ก Hint
Triple quotes preserve the string exactly as typed, including backslashes.
โ Incorrect
Using triple single quotes with backslashes inside creates a string with literal backslash characters, so escape sequences are not processed.
โ Predict Output
intermediate2:00remaining
Output of raw string with backslashes
What will this code print?
Python
path = r"C:\new_folder\test" print(path)
Attempts:
2 left
๐ก Hint
Raw strings treat backslashes as normal characters.
โ Incorrect
The raw string keeps backslashes as literal characters, so printing shows single backslashes.
โ Predict Output
advanced2:00remaining
Output of string concatenation with different quote styles
What is the output of this code?
Python
s = 'Hello' + " World" + '''!''' print(s)
Attempts:
2 left
๐ก Hint
Strings with different quotes can be concatenated normally.
โ Incorrect
All three strings concatenate into one string with spaces and exclamation mark as typed.
โ Predict Output
advanced2:00remaining
Output of string with Unicode escape sequences
What does this code print?
Python
s = "\u0048\u0065llo" print(s)
Attempts:
2 left
๐ก Hint
Unicode escape sequences represent characters by their code points.
โ Incorrect
The \u0048 is 'H' and \u0065 is 'e', so the string becomes 'Hello'.
๐ง Conceptual
expert3:00remaining
Number of characters in a string with combining Unicode characters
How many characters does this string have?
s = "e\u0301" # letter e + combining acute accent
Attempts:
2 left
๐ก Hint
Combining characters count as separate code points in Python strings.
โ Incorrect
The string has two Unicode code points: 'e' and the combining accent, so length is 2.