I have tried my best to understand the question and tried the following approach
Since we have an exchange fee, the actual rate of exchanging now becomes
Effective rate = Exchange_rate*(1 + exchange_fee_percentage)
Then I calculated how much money we can get by using a previous function
Essentially budget / effective_rate
Then the denomination is factored in
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.
"""
spread_percent = spread / 100
effective_rate = exchange_rate * (1 + spread_percent)
money_we_can_get_on_exchange = exchange_money(budget, effective_rate)
return int(money_we_can_get_on_exchange / denomination)