################################################################################
#             Exercices à rendre au plus tard le 20/09/2026 à 20h              #
#                                  Correction                                  #
################################################################################

###########################################
# Exercice 7. Évaluation d'expressions
###########################################

# 56//10 vaut 5 et est de type int
# 2**5 % 10 vaut 2 et est de type int
# 12/4 vaut 3.0 et est de type float

### Vérification:

# print(56//10)
# print(type(56//10))

# print(2**5 % 10)
# print(type(2*5 % 10))

# print(12/4)
# print(type(12/4))

###########################################
# Exercice 8. Prix toutes taxes comprises (TTC)
###########################################

################
### Question 1
################

def prix_TTC(ht, taux):
    """prix_TTC(ht: float, taux: float) -> float"""
    return ht * (1 + taux / 100)

### Tests:
# print(prix_TTC(123,10))
# print(prix_TTC(321,5.5))

################
### Question 2
################

def prix_HT(ttc, taux):
    """prix_HT(ttc: float, taux: float) -> float"""
    return ttc / (1 + taux / 100)

### Tests:
# print(prix_HT(135.3,10))
# print(prix_HT(338.655,5.5))

###########################################
# Exercice 9. Suite numérique
###########################################

def get_u(n):
    """get_u(n: int) -> int"""
    u = 0
    for i in range(n):
        u = -2*u + 1
    return u

### Tests:

# print(get_u(0))
# print(get_u(1))
# print(get_u(2))
# print(get_u(15))

###########################################
# Exercice 10. Zones de couleurs (exercice facultatif)
###########################################

def zone(x,y):
    """zone(x: int, y: int) -> NoneType"""
    if (10 <= x <= 85 and 10 <= y <= 55)\
    and not (25 <= x <= 50 and 20 <= y <= 45):
        print("Dans une zone bleue")
    elif (15 <= x <= 45 or 60 <= x <= 85) and 60 <= y <= 70:
        print("Dans une zone rouge")
    elif 0 <= x <= 90 and 0 <= y <= 70:
        print("Dans une zone jaune")
    else:
        print("En dehors de la feuille")

### Tests:

# zone(16,12)
# zone(30,22)
# zone(64,62)
# zone(-5,86)