Ninjas frequently need to signal each other in code. They often employ natural sounds as cover. Our ninja will chirp like a bird, with different am...
For further actions, you may consider blocking this person and/or reporting abuse
Javascript
Hot
Small solution in Python 3.X 😄
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 😁
My first submission at Dev.To! (Excluding the welcome post). I love computer science.
Java
Note that this assumes a few things:
None recursive javascript solution
`
As always, there is no need to use any language but Elixir. We'll establish a signature with a guard clause to make sure the user can only pass a natural number, and a private
chirp_
signature to do the work of building the list of chirps, with a default empty list as its second argument. We could useList.duplicate
, if the point of this exercise wasn't to make a recursive call 😜JavaScript
Decided to throw an error if the count is not greater than zero because a ninja won't bother spending energy on calling this secret technique for no purposes.
Training dojo available here (say
chirp
to enter).Reason
Elm
Haskell:
Also, you never said anything about Haskell standard functions :)
My solution in js
Python
chirp = lambda n : '-'.join(['chirp']*n) + '.'
how do i syntax highlight? :(