~cpp 

def back (num):
    num=str(num)
    sub_um=num[::-1]
    return int(sub_um)
def cal(number):
    j=0
    while number!=back(number):
        number=number+back(number)
        j=j+1
    print j,' ',
    return number

if __name__ == '__main__':
    t= int (raw_input('숫자를 입력해주세요>>'))
    i=t
    target=[] 
    while i>0:
        a=int (raw_input('>>'))
        target.append(a)
        i=i-1
    i=0
    while i!=t:
        print cal (target[i])
        i=i+1
 
Retrieved from http://wiki.zeropage.org/wiki.php/Reverse And Add/조현태
last modified 2021-02-07 05:27:55