나는 이렇게 학습한다/Algorithm & SQL

0121. esreveR

daco2020 2023. 1. 21. 23:43
반응형

Write a function reverse which reverses a list (or in clojure's case, any list-like data structure)

(the dedicated builtin(s) functionalities are deactivated)



Solution:

def reverse(lst):
    result = list()
    for _ in range(len(lst)): result.append(lst.pop())
    return result


반응형