|
8 | 8 |
|
9 | 9 |
|
10 | 10 | def exchange_money(budget, exchange_rate): |
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. |
| 11 | + """ |
28 | 12 |
|
| 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. |
29 | 16 | """ |
30 | 17 |
|
31 | 18 | pass |
32 | 19 |
|
33 | 20 |
|
34 | 21 | def get_change(budget, exchanging_value): |
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. |
| 22 | + """ |
53 | 23 |
|
| 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. |
54 | 27 | """ |
55 | 28 |
|
56 | 29 | pass |
57 | 30 |
|
58 | 31 |
|
59 | 32 | def get_value_of_bills(denomination, number_of_bills): |
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). |
| 33 | + """ |
77 | 34 |
|
| 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. |
78 | 38 | """ |
79 | 39 |
|
80 | 40 | pass |
81 | 41 |
|
82 | 42 |
|
83 | 43 | def get_number_of_bills(amount, denomination): |
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. |
| 44 | + """ |
102 | 45 |
|
| 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. |
103 | 49 | """ |
104 | 50 |
|
105 | 51 | pass |
106 | 52 |
|
107 | 53 |
|
108 | 54 | def get_leftover_of_bills(amount, denomination): |
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. |
| 55 | + """ |
127 | 56 |
|
| 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. |
128 | 60 | """ |
129 | 61 |
|
130 | 62 | pass |
131 | 63 |
|
132 | 64 |
|
133 | 65 | def exchangeable_value(budget, exchange_rate, spread, denomination): |
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. |
| 66 | + """ |
154 | 67 |
|
155 | | - This function calculates and returns the maximum value of the new currency after |
156 | | - determining the exchange rate plus the spread. |
| 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. |
157 | 73 | """ |
158 | 74 |
|
159 | 75 | pass |
0 commit comments