From af70a34610ce47a1c8199c5deb20369331f10ff8 Mon Sep 17 00:00:00 2001 From: Christopher Bohn <bohn@unl.edu> Date: Wed, 17 Mar 2021 14:29:19 -0500 Subject: [PATCH] Fixed bug in tail recursion example. A misplaced right-paren checked for the length of a boolean and then conditioned an `if` statement on that length. --- TailRecursion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TailRecursion.py b/TailRecursion.py index 75a26fe..90c8121 100755 --- a/TailRecursion.py +++ b/TailRecursion.py @@ -10,7 +10,7 @@ def slightly_better_iterator(a_list): def poorly_defined_adder(a_list): - if len(a_list == 0): + if len(a_list) == 0: return 0 else: return a_list[0] + poorly_defined_adder(a_list[1:]) -- GitLab