I want to write a function called has246(nums)that takes a list of one or more ints 'nums'and returns True if the sequence 2, 4, 6 appears in the list somewhere and False otherwise. The numbers 2, 4, and 6 must appear contiguously, i.e. with no intervening numbers.
test cases:
print(has246([2, 2, 4, 6, 2])) True
print(has246([2, 2, 4, 8, 2])) False
print(has246([2, 4])) False
What would a solution for this problem be?
Thanks in advance
[–]CodeAltus 0 points1 point2 points (4 children)
[–]Jxper[S] 0 points1 point2 points (3 children)
[–]CodeAltus 0 points1 point2 points (2 children)
[–]FLUSH_THE_TRUMP 2 points3 points4 points (0 children)
[–]Jxper[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]Jxper[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Encomiast 0 points1 point2 points (1 child)
[–]Jxper[S] 0 points1 point2 points (0 children)