From 0bfa95be7046b101a00f83f082260b5d0e007159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mo=C5=BEina?= Date: Tue, 25 Oct 2016 11:44:09 +0200 Subject: Added new exercises with recursion. Added description for functions. --- python/problems/recursion/find_sum/find_sum.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 python/problems/recursion/find_sum/find_sum.py (limited to 'python/problems/recursion/find_sum') 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)) - - - -- cgit v1.2.1