|
8 | 8 |
|
9 | 9 |
|
10 | 10 | def exchange_money(budget, exchange_rate): |
11 | | - """ |
| 11 | + """Calculate estimated value after exchange. |
| 12 | +
|
| 13 | + Parameters: |
| 14 | + budget (float): Tthe amount of money you are planning to exchange. |
| 15 | + exchange_rate (float): The unit value of the foreign currency. |
| 16 | +
|
| 17 | + Returns: |
| 18 | + float: The exchanged value of the foreign currency you can receive. |
| 19 | +
|
| 20 | + Examples: |
| 21 | + >>> exchange_money(127.5, 1.2) |
| 22 | + 106.25 |
| 23 | +
|
| 24 | + >>> exchange_money(200, 1.10) |
| 25 | + 181.82 |
| 26 | +
|
| 27 | + This function calculates and returns the (estimated) value of the exchanged currency. |
12 | 28 |
|
13 | | - :param budget: float - amount of money you are planning to exchange. |
14 | | - :param exchange_rate: float - unit value of the foreign currency. |
15 | | - :return: float - exchanged value of the foreign currency you can receive. |
16 | 29 | """ |
17 | 30 |
|
18 | 31 | pass |
19 | 32 |
|
20 | 33 |
|
21 | 34 | def get_change(budget, exchanging_value): |
22 | | - """ |
| 35 | + """Calculate currency left after an exchange. |
| 36 | +
|
| 37 | + Parameters: |
| 38 | + budget (float): The amount of money you own. |
| 39 | + exchanging_value (float): The amount of your money you want to exchange now. |
| 40 | +
|
| 41 | + Returns: |
| 42 | + float: The amount left of your starting currency after the exchange |
| 43 | +
|
| 44 | + Examples: |
| 45 | + .>>> get_change(127.5, 120.0) |
| 46 | + 7.5 |
| 47 | +
|
| 48 | + >>> get_change(300.75, 150.25) |
| 49 | + 150.50 |
| 50 | +
|
| 51 | + Tthis function calcultes and returns the amount of money left over from the budget |
| 52 | + after an exchange. |
23 | 53 |
|
24 | | - :param budget: float - amount of money you own. |
25 | | - :param exchanging_value: float - amount of your money you want to exchange now. |
26 | | - :return: float - amount left of your starting currency after exchanging. |
27 | 54 | """ |
28 | 55 |
|
29 | 56 | pass |
30 | 57 |
|
31 | 58 |
|
32 | 59 | def get_value_of_bills(denomination, number_of_bills): |
33 | | - """ |
| 60 | + """Calculate the total value of currency at current denomination. |
| 61 | +
|
| 62 | + Parameters: |
| 63 | + denomination (int): The value of a single unit (bill). |
| 64 | + number_of_bills (int): The total number of units (bills). |
| 65 | +
|
| 66 | + Returns: |
| 67 | + int: Calculated value of the units (bills). |
| 68 | +
|
| 69 | + Examples: |
| 70 | + >>> get_value_of_bills(5, 128) |
| 71 | + 640 |
| 72 | +
|
| 73 | + >>> get_value_of_bills(15.13, 16) |
| 74 | + 242 |
| 75 | +
|
| 76 | + This function calculates and returns the total value of the bills (excluding fractionaal amounts). |
34 | 77 |
|
35 | | - :param denomination: int - the value of a bill. |
36 | | - :param number_of_bills: int - total number of bills. |
37 | | - :return: int - calculated value of the bills. |
38 | 78 | """ |
39 | 79 |
|
40 | 80 | pass |
41 | 81 |
|
42 | 82 |
|
43 | 83 | def get_number_of_bills(amount, denomination): |
44 | | - """ |
| 84 | + """Calculate the number of currency units (bills) within the amount. |
| 85 | +
|
| 86 | + Parameters: |
| 87 | + amount (float): The total starting value. |
| 88 | + denomination (int): The value of a single unit (bill). |
| 89 | +
|
| 90 | + Returns: |
| 91 | + int: The number of units (bills) that can be obtained from the amount. |
| 92 | +
|
| 93 | + Examples: |
| 94 | + >>> get_number_of_bills(127.5, 5) |
| 95 | + 25 |
| 96 | +
|
| 97 | + >>> get_number_of_bills(35.16, 10) |
| 98 | + 3 |
| 99 | +
|
| 100 | + This function calcluates and returns the number pf currency units (bills) that can |
| 101 | + be obtained from the given amount. Whole bills only - no fractioal amounts. |
45 | 102 |
|
46 | | - :param amount: float - the total starting value. |
47 | | - :param denomination: int - the value of a single bill. |
48 | | - :return: int - number of bills that can be obtained from the amount. |
49 | 103 | """ |
50 | 104 |
|
51 | 105 | pass |
52 | 106 |
|
53 | 107 |
|
54 | 108 | def get_leftover_of_bills(amount, denomination): |
55 | | - """ |
| 109 | + """Calculate leftover amount after exchanging into bills. |
| 110 | +
|
| 111 | + Parameters: |
| 112 | + amount (float): The total starting value. |
| 113 | + denomination (int): The value of a single unit (bill). |
| 114 | +
|
| 115 | + Returns: |
| 116 | + float: The amount that is "leftover", given the current denomination. |
| 117 | +
|
| 118 | + Examples: |
| 119 | + >>> get_leftover_of_bills(127.5, 20) |
| 120 | + 7.5 |
| 121 | +
|
| 122 | + >>> get_leftover_of_bills(153.2, 10) |
| 123 | + 3.20 |
| 124 | +
|
| 125 | + This function calculates and returns the leftover amount that cannot be |
| 126 | + returned from starting amount, due to the currency denomination. |
56 | 127 |
|
57 | | - :param amount: float - the total starting value. |
58 | | - :param denomination: int - the value of a single bill. |
59 | | - :return: float - the amount that is "leftover", given the current denomination. |
60 | 128 | """ |
61 | 129 |
|
62 | 130 | pass |
63 | 131 |
|
64 | 132 |
|
65 | 133 | def exchangeable_value(budget, exchange_rate, spread, denomination): |
66 | | - """ |
| 134 | + """Calculate the maximum value of the new currency. |
| 135 | +
|
| 136 | + Parameters: |
| 137 | + budget (float): The amount of your money you are planning to exchange. |
| 138 | + exchange_rate (float): The unit value of the foreign currency. |
| 139 | + spread (int): The percentage that is taken as an exchange fee. |
| 140 | + denomination (int) The value of a single unit (bill). |
| 141 | +
|
| 142 | + Returns: |
| 143 | + int: The maximum value you can get in the new currency. |
| 144 | +
|
| 145 | + Examples: |
| 146 | + >>> exchangeable_value(127.25, 1.20, 10, 20) |
| 147 | + 80 |
| 148 | +
|
| 149 | + >>> exchangeable_value(127.25, 1.20, 10, 5) |
| 150 | + 95 |
| 151 | +
|
| 152 | + Note: |
| 153 | + The currency denomination is a whole number and cannot be sub-divided. |
67 | 154 |
|
68 | | - :param budget: float - the amount of your money you are planning to exchange. |
69 | | - :param exchange_rate: float - the unit value of the foreign currency. |
70 | | - :param spread: int - percentage that is taken as an exchange fee. |
71 | | - :param denomination: int - the value of a single bill. |
72 | | - :return: int - maximum value you can get. |
| 155 | + This function calculates and returns the maximum value of the new currency after |
| 156 | + determining the exchange rate plus the spread. |
73 | 157 | """ |
74 | 158 |
|
75 | 159 | pass |
0 commit comments