summaryrefslogtreecommitdiff
path: root/comp/work/28/1.py
blob: 5c8598c30699c6f72a12bf3adb29d7078c608afd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def addative(num):
    if len(num) >= 2:
        new = 0
        for i in num:
            new = new + int(i)
        return 1 + addative(str(new))
    else:
        return 0


def multiplative(num):
    if len(num) >= 2:
        new = 1 
        for i in num:
            new = new * int(i)
        return 1 + addative(str(new))
    else:
        return 0


num = input("number: ")

if input("m/a: ") == "m":
    print(multiplative(str(num)))
else:
    print(addative(str(num)))