What will be the output of the following Python program?

s = "COMPUTER"
print(s[1:4])
                        

Options

  • A. COM
  • B. OMP
  • C. MPU
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. OMP

Detailed Explanation

String slicing extracts characters from index 1 to index 3. Therefore, the output is OMP.