[프로그래머스] LV.0 배열 뒤집기 / 파이썬(Python)

디딧·2022년 11월 14일

프로그래머스

목록 보기
17/36

문제 설명

정수가 들어 있는 배열 num_list가 매개변수로 주어집니다. num_list의 원소의 순서를 거꾸로 뒤집은 배열을 return하도록 solution 함수를 완성해주세요.

제한사항

1 ≤ num_list의 길이 ≤ 1,000
0 ≤ num_list의 원소 ≤ 1,000

풀이

def solution(num_list):
    num_list.reverse()
    return num_list

다른 사람 풀이

def solution(num_list):
    return num_list[::-1]
profile
M.S. in Statistics, 2022 - present

0개의 댓글