# Exercice 4

def cree_file() :
    return []

def enfile(f, e):
    f.append(e)

def file_vide(f):
    return f == [] # ou len(p) == 0

def defile(f):
    return f.pop(0)

def getTete(f):
    if pile_vide(f) :
        return None
    return f[0] 
    
def somme_file(f):
    s = 0
    while not file_vide(f):
        s = s + defile(f)
    return s
    
# tests
# Code 2 : file
f = cree_file()
enfile(f, 1)
enfile(f, 2)
enfile(f, 3)
print(f)    # [1, 2, 3]
a = defile(f)
print(f)    # [2, 3]
enfile(f, 4)
enfile(f, a)
print(f)    # [2, 3, 4, 1]
print(somme_file(f))    # 10
