KnowledgeBoat Logo
|

Computer Science

Assertion (A): The swapcase() function converts an input string into a toggle case.

Reasoning (R): The swapcase() function converts all uppercase characters to lowercase and vice versa of the given string and returns it.

  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

1 Like

Answer

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

Explanation
The swapcase() function converts an input string into toggle case. It converts all uppercase characters to lowercase and all lowercase characters to uppercase in the given string and then returns the modified string.

Answered By

3 Likes


Related Questions