def solution(n):
    while n > 10:
        s = 0
        a = n
        
        while a > 0:
            s += a % 10
            a //= 10
        
        n = s
    
    return n
    
n = 123456
ret = solution(n)
print("solution 함수의 반환 값은", ret, "입니다.")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: