1. Home
  2. Data Science
  3. Python
  4. What is the value of 'python'[1:4]?

Added 2 Nov 2026

What is the value of 'python'[1:4]?

  1. 'ytho'
  2. 'yth' Correct answer
  3. 'pyt'
  4. 'pyth'

Correct answer

B. 'yth'

20 views

MCQSEXAM

Explanation

Slicing includes the start index and excludes the stop: indexes 1, 2 and 3 are 'y', 't' and 'h'.

Reference

Asked in: NTS, PPSC, Python Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs