From a8ee3a4989f77ee55535635e7d9713c3f8448d6d Mon Sep 17 00:00:00 2001 From: Spectre Date: Sat, 3 May 2025 15:06:47 +0200 Subject: [PATCH] starting 'sac a dos' problem --- programmation_dynamique/{ => monnaie}/piece.py | 0 programmation_dynamique/monnaie/piece1.py | 8 ++++++++ programmation_dynamique/piece1.py | 8 -------- 3 files changed, 8 insertions(+), 8 deletions(-) rename programmation_dynamique/{ => monnaie}/piece.py (100%) create mode 100644 programmation_dynamique/monnaie/piece1.py delete mode 100644 programmation_dynamique/piece1.py diff --git a/programmation_dynamique/piece.py b/programmation_dynamique/monnaie/piece.py similarity index 100% rename from programmation_dynamique/piece.py rename to programmation_dynamique/monnaie/piece.py diff --git a/programmation_dynamique/monnaie/piece1.py b/programmation_dynamique/monnaie/piece1.py new file mode 100644 index 0000000..f91e470 --- /dev/null +++ b/programmation_dynamique/monnaie/piece1.py @@ -0,0 +1,8 @@ +def change_render(p, price, given_money): + change = given_money - price + if change < 0: + raise Exception("the price cannot be greater than the given money") + else: + pos_m = [] # En gros ça donne les pièce inférieur au montant de change + pos_m = sorted([i for i in p if i <= change]) + pos_t = [] diff --git a/programmation_dynamique/piece1.py b/programmation_dynamique/piece1.py deleted file mode 100644 index 1654ac4..0000000 --- a/programmation_dynamique/piece1.py +++ /dev/null @@ -1,8 +0,0 @@ -def change_render(p,price,given_money): - change = given_money - price - if change< 0: - raise Exception('the price cannot be greater than the given money') - else: - pos_m = [] # En gros ça donne les pièce inférieur au montant de change - pos_m = sorted([i for i in p if i <= change]) - pos_t = []