From 64e1e4f1c27ac2dd680335a221f731074e204804 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 25 Mar 2024 09:37:19 +0100 Subject: [PATCH] Solve python/exercises/currency-exchange With help of https://exercism.org/tracks/python/exercises/currency-exchange/solutions/dollymolly as I didn't understand the last instruction. --- python/currency-exchange/exchange.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/python/currency-exchange/exchange.py b/python/currency-exchange/exchange.py index 5880035..9503c18 100644 --- a/python/currency-exchange/exchange.py +++ b/python/currency-exchange/exchange.py @@ -72,9 +72,8 @@ def exchangeable_value(budget, exchange_rate, spread, denomination): :return: int - maximum value you can get. """ - exchange = exchange_rate / 100 - cost = exchange - spread + rate = exchange_rate + exchange_rate * spread / 100 + new = exchange_money(budget, rate) + bill = get_number_of_bills(new, denomination) - result = budget - cost * denomination - - return result + return get_value_of_bills(denomination, bill)