recursion(python) help please -
i'm new programming world, , i'm struggling recursion.
this code, i'm not sure why doesn't work :(
enter_number = input("enter 'x' value: ") def g(x): if x == 0: return 1 elif x == 1: return 2 else: return g(x−1) + g(x−3) + g(x−4) print(g(enter_number))
thank you
your g
function doesn't handle inputs 2
, 3
.
Comments
Post a Comment