How do I approach this? I've tried different ways and this is what I've so far . ex: [1, 2, 5, 7]
returns True
and [1, 1, 6, 9]
returns False
. The second example doesn't work. It returns true even though first two elements are equal. What am I doing wrong?
def increasing(L):
n = len(L)
i = 0
while i <= n-1:
if L[i] > L[i+1]:
return False
else:
i+=1
return True