# Récursivité ex2

def somme(l : list[int]) -> int:
    if l == []:
        return 0
    else:
        return l[0] + somme(l[1:])

print(somme([0,1,2,3,4,5])) # 15


def somme(l : list[int], indice : int = 0) -> int:
    if indice == len(l):
        return 0
    else:
        return l[indice] + somme(l, indice + 1)

print(somme([0,1,2,3,4,5])) # 15

def minimum(l : list[int]) -> int:
    if len(l) == 1:
        return l[0]
    else:
        temp = minimum(l[1:])
        if l[0] < temp:
            return l[0]
        else:
            return temp

print(minimum([4, 5, 6, 2, 8, 9])) # 2

def minimum(l : list[int], indice : int = 0) -> int:
    if indice == len(l) - 1:
        return l[indice]
    else:
        temp = minimum(l, indice + 1)
        if l[indice] < temp:
            return l[indice]
        else:
            return temp

print(minimum([4, 5, 6, 2, 8, 9])) # 2