#Python / Task 6/Currency Exchange
1 messages · Page 1 of 1 (latest)
(spread * exchange_rate) + exchange_rate
# Use the computed rate and budget to figure out the exchanged value.
(exchange_rate * budget) / denomination
# Use the denomination to figure out how much you'd get back from the exchange.
return int()
``` This, of course, isn't correct: I am having a hard time not knowing what it is I'm not understanding.
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?
(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()
1.32 USD == 1.00 EUR
127.25 USD == 167.97 EUR ??
Don't you think something seems off?
Putting it this way: clearly, I'm supposed to divide. After cross multiplying to find x, my returned ratios allowed me to receive a return of both 80 and 95 -- spot on!