Here’s a link to the exercise I am stuck at:

I can’t figure out how to split the number(in string format) into different digits so that I can add them up. Can anyone tell me how to do it or give me a hint?


once you have the numbers in string format, you can simply use a loop to get each digit?


just simply, convert the input into to string str(x) then iterate it while converting it into digit int(x) then
add them all. y += int(x). return y.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.