#Python / Task 6/Currency Exchange

1 messages · Page 1 of 1 (latest)

elder bridge
#
  1. Use the spread to compute the rate.
  2. Use the computed rate and budget to figure out the exchanged value.
  3. Use the denomination to figure out how much you'd get back from the exchange.

Look at the prior functions for inspiration for steps 2 and 3 😉

shy canyon
elder bridge
#

The first two statements look roughly on track. The second statement uses the passed in exchange rate without the spread factored in.

#

If the exchange rate is 1.2 and the spead is 10, the effective rate (per the example in the instructions) is 1.32. Are you able to compute that?
Given an effective exchange rate (eg 1.32), you have the logic to do the conversion (rate * budget). This should very closely (if not exactly) match a prior function.
Once you have the exchanged value, you need to figure out how much you get back using a given bill. For example, if the exchange value is $115 but the demonination is $20 bills, you only get back $100.

#

Does that make sense?

#

If not, what part of that don't you understand?

shy canyon
# elder bridge If not, what part of that don't you understand?
(spread * exchange_rate) + exchange_rate

    # (0.10 * 1.20) + 1.20 = 1.32

    # Use the computed rate and budget to figure out the exchanged value.

    (exchange_rate * budget) / denomination

    # (1.32 * 127.25) = 167.97

    # If I chose 20 for the denominations, then I should expect 160 in return, or eight 20s. To use the 5, then a return of 165, or thirty-three 5s.
    
    # Use the denomination to figure out how much you'd get back from the exchange.

    return int()
final ginkgo
#
  1.32 USD ==   1.00 EUR
127.25 USD == 167.97 EUR ??

Don't you think something seems off?

shy canyon