diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/ENI-Python.iml b/.idea/ENI-Python.iml
new file mode 100644
index 0000000..8a68a59
--- /dev/null
+++ b/.idea/ENI-Python.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..8bd0204
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..2cf955c
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TP02.py b/TP02.py
new file mode 100644
index 0000000..8e6e69e
--- /dev/null
+++ b/TP02.py
@@ -0,0 +1,63 @@
+from decimal import Decimal, InvalidOperation, ROUND_HALF_UP
+
+THRESHOLD = Decimal('200.00')
+
+def read_amount(prompt: str) -> Decimal | None:
+ """Demande un montant à l'utilisateur, retourne None si 0 (arrêt)."""
+ while True:
+ s = input(prompt).strip().replace(',', '.')
+ if s == '':
+ print("Entrée vide — réessaie.")
+ continue
+ try:
+ d = Decimal(s)
+ except InvalidOperation:
+ print("Montant invalide — entre un nombre.")
+ continue
+ if d < 0:
+ print("Le montant ne peut pas être négatif.")
+ continue
+ if d == 0:
+ return None
+ return d.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)
+
+def afficher_stats(montants: list[Decimal]) -> None:
+ if not montants:
+ print("\nAucun chèque saisi pour le moment.\n")
+ return
+
+ count = len(montants)
+ total = sum(montants)
+ moyenne = (total / count).quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)
+
+ bas = [m for m in montants if m < THRESHOLD]
+ haut = [m for m in montants if m >= THRESHOLD]
+
+ bas_count, bas_total = len(bas), sum(bas) if bas else Decimal('0.00')
+ haut_count, haut_total = len(haut), sum(haut) if haut else Decimal('0.00')
+
+ min_montant = min(montants)
+ max_montant = max(montants)
+
+ print("\n--- Récapitulatif ---")
+ print(f"Nombre de chèques : {count}")
+ print(f"Montant total : {total} €")
+ print(f"Moyenne des montants : {moyenne} €")
+ print(f"Chèques < {THRESHOLD} € : {bas_count} (total = {bas_total} €)")
+ print(f"Chèques >= {THRESHOLD} € : {haut_count} (total = {haut_total} €)")
+ print(f"Chèque le plus petit : {min_montant} €")
+ print(f"Chèque le plus grand : {max_montant} €\n")
+
+def main():
+ montants: list[Decimal] = []
+
+ print("Saisie des chèques — entre 0 pour terminer.")
+ while True:
+ montant = read_amount("Montant du chèque en € (0 pour terminer) : ")
+ if montant is None:
+ break
+ montants.append(montant)
+ afficher_stats(montants)
+
+if __name__ == "__main__":
+ main()