Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
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
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

PythonHolic

[python] 숫자를 입력받고 , 그 자릿수를 반대로 뒤집어 출력하기 본문

파이썬 과제 도와주기 일지

[python] 숫자를 입력받고 , 그 자릿수를 반대로 뒤집어 출력하기

devpy 2020. 6. 25. 15:55

n = int(input())
temp = ""
for i in range(len(str(n))):
    if i==0:
        temp += str(n%10)
    elif i>0 and i<len(str(n))-1:
        temp += str(n//(10**i)%10)
    elif i==len(str(n))-1:
        temp += str(n//(10**(len(str(n))-1)))


print(temp)
Comments