From 309eae983e57857689fbabc5530e72e2659563f9 Mon Sep 17 00:00:00 2001 From: Milan Suk Date: Sun, 28 Apr 2019 18:58:07 +0200 Subject: [PATCH] alphametics: sync with problem-specifications --- exercises/alphametics/alphametics_test.py | 4 ++-- exercises/alphametics/example.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exercises/alphametics/alphametics_test.py b/exercises/alphametics/alphametics_test.py index daa47cbd8b..01f7d9130a 100644 --- a/exercises/alphametics/alphametics_test.py +++ b/exercises/alphametics/alphametics_test.py @@ -10,10 +10,10 @@ def test_puzzle_with_three_letters(self): self.assertEqual(solve("I + BB == ILL"), {"I": 1, "B": 9, "L": 0}) def test_solution_must_have_unique_value_for_each_letter(self): - self.assertEqual(solve("A == B"), {}) + self.assertEqual(solve("A == B"), None) def test_leading_zero_solution_is_invalid(self): - self.assertEqual(solve("ACA + DD == BD"), {}) + self.assertEqual(solve("ACA + DD == BD"), None) def test_puzzle_with_two_digits_final_carry(self): self.assertEqual( diff --git a/exercises/alphametics/example.py b/exercises/alphametics/example.py index 7543bebabb..6a7a869961 100644 --- a/exercises/alphametics/example.py +++ b/exercises/alphametics/example.py @@ -108,11 +108,11 @@ def check_rec(eqparams, tracecombo=(dict(), 0, set(range(10))), p=0): # if the recursive call returned a non-empty dictionary # this means the recursion has found a solution # otherwise, proceed to the new permutation - if len(rectest) > 0: + if rectest and len(rectest) > 0: return rectest # if no permutations are avaialble or no - # permutation gave the result return the empty dictionary - return dict() + # permutation gave the result return None + return None def solve(an):