Computer Science

Which of the following is the correct syntax of String Slicing?

  1. String_name [start : end]
  2. String_name [start : step]
  3. String_name [step : end]
  4. String_name [step : start]

Python String Manipulation

1 Like

Answer

String_name [start : end]

Reason — In Python, the correct syntax for string slicing is String_name[start:end], where 'start' is the index where the slice begins, and 'end' is the index where the slice ends.

Answered By

1 Like


Related Questions