My original python program used string interpolation to take a number a user enters between 0-9999 like 2928, and summed its individual digits (2+9+2+8=21), and then split the number until eventually it became a single digit number (in this case 3), which was displayed on the screen. The code looks like this:
Now I am needing to figure out a way to do the same without using string interpolation(converting the integers to strings and then splitting the strings, reconverting them to integers, and summing them). I am fairly new to python and therefore can use very simple commands (most complex being the while loop) can anyone help me out/ throw me some ideas?
*ps, I guess some ambiguity exists as to what yearint- year is. "year" is a command that i didnt write above but its code makes the user enter a number between 0-9999. I changed its variable name to "yearint" because I am new to python and want to make things descriptive so I can remember them when I look back. SO basically year/yearint are the input the user inputs.