Can someone explain why this Python code:
def function(string, i, j): if (i < j): i = i+1 string1 = string[i:j] return string1 else: return string # main string = "four score and seven years ago" i = 5 j = 9 stringslice = function(string, i, j) print (stringslice) print (i, j)
prints:
cor 5 9
I thought it should print the following:
cor 6 9