[알각코] 백준 1110번 - 더하기 사이클

백준 1110번

numStr = input()

if len(numStr) == 1:
    numStr = numStr + '0'

cycle = 0
num = numStr

while True:
    nList = list(map(int, num))
    if len(str(sum(nList))) == 2:
        sList = list(str(sum(nList)))
        sumNum = sList[1]
    else: 
        sumNum = str(sum(nList))
    numList = [nList[1], sumNum]
    num = ''.join([str(x) for x in numList])
    cycle = cycle + 1
    if (num == numStr): break

print(cycle)

Screen Shot 2021-07-26 at 5 39 23 PM