🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

अगर s = "Information" हो, तो print(s[2:8]) का output क्या होगा?

If s = "Information", what is the output of print(s[2:8])?

A
format
B
formatio
C
nformat
D
formatn
Explanation

s = "Information"
print(s[2:8])


Python slicing syntax:

python

s[start : end]


*Start index = 2 → include होता है

*End index = 8 → exclude होता है

🔹 Indexing of "Information":

Index Character
0 I
1 n
2 f
3 o
4 r
5 m
6 a
7 t
8 i

➡ So, s[2:8] gives: 'format'

🔸 लेकिन ध्यान दें कि index 2 पर 'f' है, ना कि 'n'।
तो s[2:8] = 'format'

✅ Correct Answer: A) format

Correct Answer: A) format

Latest Updates