# Exercice 2

def car_S1(x): return x > 0 and isinstance(x, int)
def car_S2(x): return x > 0 and x%2==0
def car_S3(x): return x in [0,3,7,9]
def car_S4(x): return 10 <= x and x <= 1000
def car_S5(x): return False

# Exercice 3

def union(f,g): return lambda x: f(x) or g(x)

# Exercice 4

def inter(f,g): return lambda x: f(x) and g(x)

# Exercice 5 

def ajout(x, f): return union(f, lambda n: x == n)

# Exercice 6 

def ensemble(l): 
    e = car_S5
    for i in l:
        e = ajout(e, i)
    return e

