Answer the question
In order to leave comments, you need to log in
How to check if an array is ascending?
The task is to check if the sequence is increasing, but there is one "but" - you can remove one element in order to achieve a constant increase in the list.
More details: https://app.codesignal.com/arcade/intro/level-2/2m... .
What is wrong in my solution?
def almostIncreasingSequence(sequince):
increases = True
removed = False
for n in range(1, len(sequince)):
print(n)
if sequince[n] <= sequince[n - 1] and not(removed):
removed = True
continue
if sequince[n] <= sequince[n - 1] and removed:
return False
return True
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question