Skip to content

Instantly share code, notes, and snippets.

@0xMurage
Created January 25, 2019 19:40
Show Gist options
  • Save 0xMurage/c82bc51241eb38877434bc0e96f6a2ff to your computer and use it in GitHub Desktop.
Save 0xMurage/c82bc51241eb38877434bc0e96f6a2ff to your computer and use it in GitHub Desktop.
'''
Function takes an array of ints as parameter.
Returns True if the sequence.. 1, 3, 4 .. appears in the array somewhere.
'''
def sequenceMatches(arrayOfNumbers):
for index in range(len(arrayOfNumbers)-2):
if arrayOfNumbers[index] == 1 and arrayOfNumbers[index+1] == 2 and arrayOfNumbers[index+2] == 3:
return True
return False
print(sequenceMatches([3,4,5,56,6,6,5,6,6,6,2,1,2,3]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment