Ad
  • Custom User Avatar
  • Custom User Avatar

    The function's name should be digital_root not sum_digits and you're doing recursion wrong for this problem, you're only adding all digits once. Unless that's one function you use in your code and you didn't write the rest of it.

    If that value has more than one digit, continue reducing in this way until a single-digit number is produced.

  • Custom User Avatar

    No there is no problem with Javascript or Python (there are more than 13k solutions for both of them). It's a problem with your code, probably you are using a global variable.