Nice one! But you forgot an edge case. I can still call it with a negative value and get a recursion error.
print(recursive_ninjas(-10)); # RecursionError: maximum recursion depth exceeded in comparison
I think you should add another if else branch for when the value is less or equal than zero.
if else
Given some context, which is ninjas talking, I doubt that they can talk negativly or that not talking at all is considered as talking
However, without those information, I fully agree ! 😄
I was reading the old ninja scroll all wrong... Thanks sensei 😁
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice one! But you forgot an edge case. I can still call it with a negative value and get a recursion error.
I think you should add another
if else
branch for when the value is less or equal than zero.Given some context, which is ninjas talking, I doubt that they can talk negativly or that not talking at all is considered as talking
However, without those information, I fully agree ! 😄
I was reading the old ninja scroll all wrong... Thanks sensei 😁