diff options
Diffstat (limited to 'challenge-202/robert-dicicco/python/ch-1.py')
| -rw-r--r-- | challenge-202/robert-dicicco/python/ch-1.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/challenge-202/robert-dicicco/python/ch-1.py b/challenge-202/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..da8ed94478 --- /dev/null +++ b/challenge-202/robert-dicicco/python/ch-1.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python + + + +# AUTHOR: Robert DiCicco + +# DATE : 2023-01-30 + +# Challenge 202 Consecutive Odds ( Python ) + + + +import re + + + +arrays = [[1,5,3,6],[2,6,3,5],[1,2,3,4],[2,3,5,7]] + + + +for arr in arrays : + + print("Input: @array = ",arr) + + check = '' + + for x in range(0,len(arr)) : + + if (arr[x] % 2 == 0) : + + check += 'e' + + else : + + check += 'o' + + if check.find('ooo') >= 0 : + + print("Output: 1\n") + + else: + + print("Output: 0\n") + + + +# SAMPLE OUTPUT + +# python .\ConsecutiveOdds.py + +# Input: @array = [1, 5, 3, 6] + +# Output: 1 + + + +# Input: @array = [2, 6, 3, 5] + +# Output: 0 + + + +# Input: @array = [1, 2, 3, 4] + +# Output: 0 + + + +# Input: @array = [2, 3, 5, 7] + +# Output: 1 |
