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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -