Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit a7f8cd1

Browse files
committed
Marked "withdraw_rev" as not implemented
Requires backtracking algorithm implementation. Will be resolved in the future (#50). Signed-off-by: Serhii Horodilov <sgorodil@gmail.com>
1 parent c2a097b commit a7f8cd1

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/atm/func.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,7 @@ def withdraw_rev(target: int,
8686
8787
"""
8888

89-
if target < 1:
90-
return []
91-
92-
if denominations is None:
93-
denominations = DENOMINATIONS
94-
denominations = sorted(denominations)
95-
96-
size: int = len(denominations)
97-
multipliers = [0] * size
98-
99-
# TODO: adjust multipliers (e.g. withdraw_rev(17) -> [(10, 1), (3, 2)]
100-
# instead of [(9, 1), (4, 2)]
101-
for idx in range(size):
102-
multipliers[idx] = min(limit, target // denominations[idx])
103-
target -= multipliers[idx] * denominations[idx]
104-
105-
# filter zero multipliers
106-
filtered = filter(lambda pair: pair[0] > 0, zip(multipliers, denominations))
107-
108-
return sorted(filtered, key=lambda pair: pair[1])
89+
raise NotImplementedError
10990

11091

11192
def get_total(pairs: Iterable[Tuple[int, int]]) -> int:

tests/atm/func_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_withdraw_outcome_balance():
3030
assert atm.get_total(atm.withdraw(2000)) == 2000
3131

3232

33+
@pytest.mark.xfail(reason="not implemented")
3334
def test_withdraw_rev():
3435
assert atm.withdraw_rev(-500) == []
3536
assert atm.withdraw_rev(0) == []

0 commit comments

Comments
 (0)