1.9 KiB
1.9 KiB
Hints
General
- The Python Numbers Tutorial and Python numeric types can be a great introduction.
1. Estimate value after exchange
- You can use the division operator to get the value of exchanged currency.
2. Calculate currency left after an exchange
- You can use the subtraction operator to get the amount of change.
3. Calculate value of bills
- You can use the multiplication operator to get the value of bills.
4. Calculate number of bills
-
You need to divide
amountintodenomination. -
You need to use type casting to
intto get the exact number of bills. -
To remove decimal places from a
float, you can convert it toint.Note: The
//operator also does floor division. But, if the operand hasfloat, the result is stillfloat.
5. Calculate leftover after exchanging into bills
- You need to find the remainder of
amountthat does not equal a wholedenomination. - The Modulo operator
%can help find the remainder.
6. Calculate value after exchange
- You need to calculate
spreadpercent ofexchange_rateusing multiplication operator and add it toexchange_rateto get the exchanged currency. - The actual rate needs to be computed. Remember to add exchange rate and exchange fee.
- You can get exchanged money affected by commission by using divide operation and type casting to
int.