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.
what? it's 5 kata example? its very-very easy for 5 kata
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.my code are giving this output:
4423583 --> 4 + 4 + 2 + 3 + 5 + 8 + 3 = 29 --> 2 + 9 = 11 --> 1 + 1 = 2
idk what this task want from me
i think what my visualization is not needed?