How to solve the currency exchange problem?

I can’t calculate value after exchange Currency exchange Point 6

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

This solution doesn’t use the denomination argument.

Remember that the currency denomination is a whole number, and cannot be sub-divided.

This task is asking that the exchange be done by converting to a single bill/denomination.

Sorry i don’t understand how to use denomination. Can you explain what to do?

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 :)

2 Likes