Suppose s="mrunal"
I want to print run
for that I am doing print(s[1:4])
But in python why print(s[1:3])
is not available.
Simply I want to tell that why end
in slicing is not that index which we want as last character?
s="mrunal"
index 0 = "m"
index 1 = "r"
index 2 = "u"
index 3 = "n"
index 4 = "a"
index 5 = "l"
here index for "n"
is 3. Why end index is not same as s[1:3]
? Why it is not inclusive? why it uses exclusive?