1.py (480B)
1 def addative(num): 2 if len(num) >= 2: 3 new = 0 4 for i in num: 5 new = new + int(i) 6 return 1 + addative(str(new)) 7 else: 8 return 0 9 10 11 def multiplative(num): 12 if len(num) >= 2: 13 new = 1 14 for i in num: 15 new = new * int(i) 16 return 1 + addative(str(new)) 17 else: 18 return 0 19 20 21 num = input("number: ") 22 23 if input("m/a: ") == "m": 24 print(multiplative(str(num))) 25 else: 26 print(addative(str(num)))