aboutsummaryrefslogtreecommitdiff
path: root/challenge-269/eric-cheung/python/ch-1.py
blob: eaf14a1911fa340c114ac6a2314967a2d93fa71b (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
from itertools import combinations

def GetBitWiseOR (arrInput):

    nResult = 0
    for rLoop in arrInput:
        nResult = nResult | rLoop
    return nResult

## arrInt = [1, 2, 3, 4, 5]  ## Example 1
## arrInt = [2, 3, 8, 16]  ## Example 2
arrInt = [1, 2, 5, 7, 9]  ## Example 3

bIsEven = False

for nLoop in range(2, len(arrInt) + 1):

    arrCombList = combinations(arrInt, nLoop)

    for arrLoop in list(arrCombList):
        if GetBitWiseOR (arrLoop) % 2 == 0:
            bIsEven = True
            break

    if bIsEven:
        break

print (bIsEven)