diff options
Diffstat (limited to 'python/problems/recursion/find_sum')
-rw-r--r-- | python/problems/recursion/find_sum/find_sum.py | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/python/problems/recursion/find_sum/find_sum.py b/python/problems/recursion/find_sum/find_sum.py deleted file mode 100644 index 85f472b..0000000 --- a/python/problems/recursion/find_sum/find_sum.py +++ /dev/null @@ -1,19 +0,0 @@ -def find_sum(xs, gs): - if gs < 0: - return False - if gs == 0: - return True - if not xs: - return False - return find_sum(xs[1:], gs-xs[0]) or find_sum(xs[1:], gs) - -print (find_sum([2,7,3,1,4], 10)) -print (find_sum([2,3,2,4], 10)) -print (find_sum([], 10)) -print (find_sum([1,2,3], 2)) -print (find_sum([1,2,3], 7)) -print (find_sum([2,7,3,1,4], 9)) -print (find_sum([2,7,3,2,4], 17)) - - - |