def exchangeable_value(budget, exchange_rate, spread, denomination):
"""
:param budget: float - the amount of your money you are planning to exchange.
:param exchange_rate: float - the unit value of the foreign currency.
:param spread: int - percentage that is taken as an exchange fee.
:param denomination: int - the value of a single bill.
:return: int - maximum value you can get.
"""
computed_spread = (exchange_rate / 100) * spread
computed_exchange_rate = computed_spread + exchange_rate
computed_budget = exchange_money(budget, computed_exchange_rate)
return computed_budget
It is explained in Task 3 “Calculate value of bills” that the exchanging booth can only give you cash in certain bill unit (so, for example twelves, hundreds, etc.) and they won’t give you any pennies left from the total. What you wrote in your code will calculate only the total value after the exchange, let’s say it’s 222.75. But they cannot give you full 222.75 because they can only give you money in 50s, so they will give you 200 in 4 bills (and they keep 22.75). If the denomination argument was 20, then they would give you 220 in 11 bills and keep 2.75. You have to calculate the amount of money you will receive using the given denomination. I hope that helps :)
def exchangeable_value(budget, exchange_rate, spread, denomination):
"""
:param budget: float - the amount of your money you are planning to exchange.
:param exchange_rate: float - the unit value of the foreign currency.
:param spread: int - percentage that is taken as an exchange fee.
:param denomination: int - the value of a single bill.
:return: int - maximum value you can get.
"""
actual_rate = exchange_rate + ((exchange_rate*spread)/100)
return int(exchange_money(budget,actual_rate)) - get_leftover_of_bills(budget,denomination)
pass
for test 7, I am incorporating the denominator but i’m off by the actual answer by 8.