JiYoung Dev 🖥

[python] for문 - 거꾸로 반복 본문

python

[python] for문 - 거꾸로 반복

Shinjio 2023. 8. 23. 08:05

for i in reversed(range(n)):

혹은

for i in range(n, 0, -1):

 

def solution(my_string):
    answer = ''
    
    for i in reversed(range(len(my_string))):
        answer += my_string[i]
    return answer