Question:

Identify the output of the following code snippet:

s = "the Truth"
print(s.capitalize())

Show Hint

capitalize() makes the first character upper case and every other character lower case.
Updated On: Oct 20, 2026
  • The truth
  • THE TRUTH
  • The Truth
  • the Truth
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Recall what capitalize() does:
The string method capitalize() returns a new string.
It turns the first character to upper case and all the other characters to lower case.

Step 2: Apply it to the string:
The string is s = "the Truth".
The first character 't' becomes 'T'.
The rest, 'he Truth', becomes lower case, so 'T' of Truth becomes 't'.
The result is 'The truth'.

Step 3: Check option (A):
'The truth' matches the result exactly. So (A) is correct.

Step 4: Why the other options are wrong:
(B) 'THE TRUTH' is what upper() gives.
(C) 'The Truth' is what title() gives. capitalize() does not keep or raise the capital T of Truth.
(D) 'the Truth' is the original string. capitalize() changes the first letter, so the string cannot stay the same.

Final Answer:
The code prints The truth, which is option (A).
Was this answer helpful?
0
0