Ad
  • Default User Avatar

    what? it's 5 kata example? its very-very easy for 5 kata

  • Default User Avatar

    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 (an integer) 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 return 7. That allows you to conclude that the kata wants you to return an integer as the result.

  • Default User Avatar

    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?