Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Hi, and welcome to Codewars,
Yes, your problem is that you are returning the "string" shown in the Description (really cool solution by the way!) but all the kata wants you to do is return the final result, as an
integer
.So in the above example, just rewrite your code to return
2
(aninteger
) rather than the whole string with the-->
etc.By the way, for future reference - if you are unsure about what is required for you to return in any kata, you can check the "Sample Tests" in bottom right of your screen - for example, here you will see:
test.assert_equals(digital_root(16), 7)
which means that, for input of
16
your code should return7
. That allows you to conclude that the kata wants you to return aninteger
as the result.