+ 1
mystring="abcdefghijk" mystring [2:7:2] 'ceg'
Can anyone give full explanation how we get output as 'ceg'
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
+ 1
What language do you use ? Please put the language you use in the tags.
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.