KnowledgeBoat Logo
LoginJOIN NOW

Computer Science

Assertion (A): Slicing a string involves extracting substring(s) from a given string.

Reasoning (R): Slicing does not require start and end index value of the string.

  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

A is true but R is false.

Explanation
String slicing is the process of extracting a part of a string (substring) using a specified range of indices. A substring can be extracted from a string using the slice operator, which includes two indices in square brackets separated by a colon ([:]). The syntax is string_name[start:end:step].

Answered By

3 Likes


Related Questions