aboutsummaryrefslogtreecommitdiff
path: root/challenge-202/robert-dicicco/python/ch-1.py
blob: da8ed944785cc44b6ffceece29df0785d58a746f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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