str1="divyansh tiwari" # this is just a string
var1=str1[-1:-16:1] # in this i know that the slicing will start at -1 index that is the last index and will end on the -16th index that is excluding -16th index but here i used a positive number for steps that is 1 and this kinda slicing is making my control to go beyond the indexes but it is not show a error i am fine with that but its also not showing any output i am fine with that too but lets look down to the var2
print(var1)
var2=str1[-1:16:1] # here same terminology is used but the stopping index in changed to +16 from -16 and this is showing me a output that is prompting me with the last "i" in the string str1
print(var2)
# my question is that why second one is showing a output ( if you say that slicing includes the start index then what happened with the var1 output it is also starting with the same index)
var1=str1[-1:-16:1] # in this i know that the slicing will start at -1 index that is the last index and will end on the -16th index that is excluding -16th index but here i used a positive number for steps that is 1 and this kinda slicing is making my control to go beyond the indexes but it is not show a error i am fine with that but its also not showing any output i am fine with that too but lets look down to the var2
print(var1)
var2=str1[-1:16:1] # here same terminology is used but the stopping index in changed to +16 from -16 and this is showing me a output that is prompting me with the last "i" in the string str1
print(var2)
# my question is that why second one is showing a output ( if you say that slicing includes the start index then what happened with the var1 output it is also starting with the same index)