KnowledgeBoat Logo
|

Computer Science

Assertion (A): print('INDIA'.capitalize())
This command on execution shall display the output as 'India'.

Reasoning (R): The capitalize() method returns a string where the first character is uppercase and the rest is lower case.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python String Manipulation

3 Likes

Answer

Both A and R are true and R is the correct explanation of A.

Explanation
The capitalize() method in Python converts the first character of a string to uppercase and the rest of the characters to lowercase. The statement 'INDIA'.capitalize() will return "India" because it converts the first letter to uppercase and all other letters to lowercase.

Answered By

3 Likes


Related Questions