Post

@Python_Dv Answer: B — tho
Python slicing is [start:end) → index 2 to 4.
"python" → p(0) y(1) t(2) h(3) o(4) n(5) → "tho"
English

@Python_Dv B) tho
"python"[2:5] Index 2 = t, Index 3 = h, Index 4 = o Slicing stops before index 5
String slicing before morning coffee, still got it
English

@Python_Dv Answer is B) tho
String slicing is start-inclusive, end-exclusive.
"python"[2:5] → characters at index 2,3,4 → t h o.
English

@Python_Dv The correct option here is B
This is because the index number in Python starts from 0. So when you count it well, you'll see it actually starts from t and stops at o.
The last string variable can't be printed because the given iteration is from 2 to 5, i.e it stops before 5 (4)
English

@Python_Dv (B) tho
String Slicing: In Python, string slicing uses the syntax string[start:end]. The slice includes characters starting from the start index up to, but not including, the end index.
Indexing: The string "python" is indexed as follows (starting from index 0):
p: index 0
English

@Python_Dv Top 10 Premium Software Engineering Courses
Beginner to Advanced • Practical Learning
Video Lectures + Study Materials Included
💰 All at just ₹499
📩 DM for course access
#CSE #Programming #Developers #Students #Tech

English

@Python_Dv B, although I wish it was more explicit with "python".slice(2, 5, 1) or something
English

@Python_Dv B.
"python"[2:5] takes the characters at positions 2, 3, and 4, which are t, h, o.
English

@Python_Dv tho?
not entirely sure if string slicing can be done directly like that. i’m more used to storing the string in a variable and then slicing it
English

@Python_Dv B.(tho)
"Python" index, 2 = (t), 3 = (h), 4 =(O)
English

@Python_Dv the answer is B, giving that the upper bound is exclusive and indexing starts from 0
English



























