+ 1

mystring="abcdefghijk" mystring [2:7:2] 'ceg'

Can anyone give full explanation how we get output as 'ceg'

8th May 2019, 8:59 PM
SMAUH
4 Answers
+ 8
It's a string slice that goes from index 2 to index 6 (7 is not included) in steps of 2: Substring starting at index 2: cdefghijk Substring ending at index 6: cdefg Taking every other character: ceg
8th May 2019, 9:08 PM
Anna
Anna - avatar
+ 2
sneeze The string indices indicate that it is Python, but you're right - OP should tag the programming language.
8th May 2019, 9:23 PM
inxanedev!
inxanedev! - avatar
+ 1
What language do you use ? Please put the language you use in the tags.
8th May 2019, 9:05 PM
sneeze
sneeze - avatar
0
Sneeze & InxaneNinja Thanks for reminding the "tag" realted thing, Next time before asking question i will keep in mind. Anna thank you so much for the question realted answer which actually i was looking for and also giving answer without checking "tag" and knowing the question is realted to which language.
8th May 2019, 11:54 PM
SMAUH