Quiz 3

def gen(data, func):
    for x in data:
        if func(x):
            yield x
                
def isIterable(x):
    try:
        x = iter(x)
        return True
    except TypeError:
        return False

def isEven(n):
    return n % 2 == 0

def isOdd(n):
    return n % 2 != 0

def f1(n):
    return n * 2

def f2(n):
    return n * 3

def f3(n):
    return n ** 2

def test():
    data1 = [11, 22, 33, 44, 55, 66, 77]
    for i in gen(data1, isEven):
        print ('val: {}'.format(i))

test ()