Apr-17-2017, 02:43 AM
I recently just picked up python so I may not have the best answer...I have already solved it though.
My code has 2 functions. One function to count how many digits are in the number and another function that adds the digits in a number together.
I used a FOR loop to iterate through the number , adding each individual digit to a list. After that I made a variable to hold the sum of the numbers in the list.
My digit counting function counts the digits of the "final answer" , I then used a IF/ELSE statement to determine whether the digits could be added together further. If not return the "final answer" if yes then repeat.
My code has 2 functions. One function to count how many digits are in the number and another function that adds the digits in a number together.
I used a FOR loop to iterate through the number , adding each individual digit to a list. After that I made a variable to hold the sum of the numbers in the list.
My digit counting function counts the digits of the "final answer" , I then used a IF/ELSE statement to determine whether the digits could be added together further. If not return the "final answer" if yes then repeat.