I keep getting the following error message "The program took too long to finish. Check your code for infinite loops
and try again". I thought that my loop was not infinite because n will eventually hit zero. Where did I go wrong?
def digit_sum(n): n_sum = 0 while n != 0: n_sum = n_sum + (n % 10) n // 10 return n_sum