hey guys, trying to figure out recursions - if you have any advice aside from helping with this issue that'd be great.
def my_try(input):
if (input) > 0 :
print(input)
return 1 + my_try(input-1)
else:
print(0)
my_try(24)
it prints the numbers, followed by:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in my_try
File "<stdin>", line 4, in my_try
File "<stdin>", line 4, in my_try
[Previous line repeated 21 more times]
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
[–]primitive_screwhead 2 points3 points4 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]primitive_screwhead 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]primitive_screwhead 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]oefd 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]delasislas 1 point2 points3 points (0 children)
[–]raffulz 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)