So I've been at this for a while. I'm trying to create a function that checks if the numbers in a list are increasing. For example [1, 2, 3] is True but [1, 3, 2] is False. I have gotten to the point where it will say [1, 2, 3] is True, [3, 2, 1] is False, but [1, 3, 2] is still True. I assume it is only because only the first two positions are being read?
Here is the function for reference:
def increasing(lst):
index = 0
index2 = index + 1
while index < len(lst):
if lst[index] >= lst[index2]:
index += 1
index2 += 1
return False
else:
while index < len(lst):
if lst[index] < lst[index2]:
index += 1
index2 += 1
return True