Post

Python Developer
Python Developer@Python_Dv·
🤔🚀 Comment your answers below! 👇
Python Developer tweet media
English
60
17
162
24.1K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@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
0
0
4
1.1K
Jenny
Jenny@JennyTheDev·
@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
0
0
3
1.8K
ANKIT 𓃱
ANKIT 𓃱@A9kitSingh·
@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
0
0
3
344
Gizzy Codes
Gizzy Codes@GafarIb42311292·
@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
0
0
2
423
Earnest Codes
Earnest Codes@Earnesto037·
@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
1
0
2
726
ワカメ
ワカメ@WakameSushiSuki·
@Python_Dv B, although I wish it was more explicit with "python".slice(2, 5, 1) or something
English
0
0
1
48
Mohamed
Mohamed@mohamed_e212·
@Python_Dv B. "python"[2:5] takes the characters at positions 2, 3, and 4, which are t, h, o.
English
0
0
0
206
enzo
enzo@big_data777·
@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
0
0
0
6
obi
obi@obianalytics·
@Python_Dv the answer is B, giving that the upper bound is exclusive and indexing starts from 0
English
0
0
0
1
Paylaş