Skip to content

Commit 3e681b7

Browse files
committed
Reverting change to currency exchange since this is a different exercise.
1 parent 6e0a585 commit 3e681b7

1 file changed

Lines changed: 26 additions & 110 deletions

File tree

exercises/concept/currency-exchange/exchange.py

Lines changed: 26 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -8,152 +8,68 @@
88

99

1010
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+
"""
2812
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.
2916
"""
3017

3118
pass
3219

3320

3421
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+
"""
5323
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.
5427
"""
5528

5629
pass
5730

5831

5932
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+
"""
7734
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.
7838
"""
7939

8040
pass
8141

8242

8343
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+
"""
10245
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.
10349
"""
10450

10551
pass
10652

10753

10854
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+
"""
12756
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.
12860
"""
12961

13062
pass
13163

13264

13365
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+
"""
15467
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.
15773
"""
15874

15975
pass

0 commit comments

Comments
 (0)