Created
January 25, 2019 19:40
-
-
Save 0xMurage/c82bc51241eb38877434bc0e96f6a2ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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