I'm a beginner in Python, and computer languages in general, and I'm totally stumped on how to format this iteration into a function. The iteration takes the sum of someone's birth year, month, and day and adds it together to create a sum of those numbers, and then the second iteration takes the first sum and adds those numbers together to create a final sum.
I have the users input their birthyear, month, and day (all converted to int) and this is the first sum (Example: A bday of 01/01/1997= 1999):
first_sum=b_yr + b_dy + b_mo
Then the first iteration takes the sum and adds the numbers together (Example: 1999 = 1+9+9+9 = 28):
z = first_sum zstr1=str(z) accum1=0 for x in zstr1: accum1 += int(x) (accum1)
Then the second iteration takes the first sum and adds those numbers again to create the final sum (Example: 28 = 2+8 = 10):
str2=str(accum1) accum2=0 for cnt2 in str2: accum2 += int(cnt2)