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

'abcdefg'[2:5] का output क्या होगा?

What is the output of 'abcdefg'[2:5]?

A
cde
B
def
C
bcd
D
cd
Explanation

Python में slicing का syntax होता है:

 
string[start : end]

यहाँ:

  • start index से शुरू होता है (include होता है),

  • लेकिन end index तक नहीं जाता (exclude होता है)।


उदाहरण:

 
'abcdefg'[2:5]
  • Index 2 → 'c'

  • Index 3 → 'd'

  • Index 4 → 'e'

  • Index 5 → excluded

इसलिए output होगा: 'cde'

Correct Answer: A) cde

Latest Updates