This is the exercise I’m stuck on:
This is the error message i got:
Your function fails on digit_sum(434). It returns 4 when it should return 11.
I have tested the same code on a python IDE and it worked so i don’t understand what the issue is here. Please help.
**my code:** total = 0 import math def digit_sum(n): global total num = n while num > 10: num = num/10 while num - math.floor(num) != 0: floored = math.floor(num) total = total + floored num = num - floored num = round(num, 2) num = num * 10 total = total + num return total