So I'm writing this code to see if an element in a list could be removed to make the list increasing. in the code below why do I get this error?
def almostIncreasingSequence(sequence):
sorted_sequence = sorted(sequence)
counter = 0
for i in len(sequence):
if sorted_sequence[i] != sequence[i]:
counter += 1
if counter > 1:
return True
else:
return False
for i in len(sequence).len(sequence)is a number. You probably meanrange(len(sequence)).