#Exercice 1

# Mystère 1
def moyenne(note_1, note_2, note_3, note_4):
    resultat = (note_1 + note_2 + note_3 + note_4) / 4
    return resultat

# Mystère 2
def est_pair(nombre):
    if nombre%2 == 0:
        return True
    else:
        return False

# Mystère 3
def max2(nombre_1, nombre_2):
    if nombre_1 >= nombre_2:
        return nombre_1
    else:
        return nombre_2

# Mystère 4
def multiplication(nombre_1, nombre_2):
    produit = 0
    for _ in range(nombre_2):
        produit = produit + nombre_1
    return produit

# Mystère 5

def division_euclidienne(dividende, diviseur):
    quotient = dividende // diviseur
    reste = dividende % diviseur
    return (quotient, reste)
    
# Mystère 6

def reciproque_de_Pythagore(cote_1, cote_2, cote_3):
    cote_1 = cote_1**2
    cote_2 = cote_2**2
    cote_3 = cote_3**2
    est_rectangle = cote_1 == (cote_2 + cote_3)
    est_rectangle = est_rectangle or cote_2 == (cote_1 + cote_3)
    est_rectangle = est_rectangle or cote_3 == (cote_1 + cote_2)
    return est_rectangle
    
# Mystère 7
def echange(liste, indice_1, indice_2):
    temporaire = liste[indice_1]
    liste[indice_1] = liste[indice_2]
    liste[indice_2] = temporaire
    
# Mystère 8
def conversion_binaire(nombre):
    liste_bits = []
    while nombre > 0:
        if nombre%2 == 0:
            liste_bits.insert(0, 0)
            nombre = nombre // 2
        else:
            liste_bits.insert(0, 1)
            nombre = (nombre - 1) // 2
    return liste_bits
