Write a function called digit_sum that takes a positive integer n as input and returns the sum of all that number’s digits. For example: digit_sum(1234) should return 10 which is 1 + 2 + 3 + 4. (Assume that the number you are given will always be positive.)
I’m not sure how to separate the digits of “n” without using a precise value. Do I count the digits first? I tried turning “n” into a string and calculating the length, but not sure what to do with that information.