Lv0 프로그래머스(Programmers)[Python][파이썬] 무작위로 k개의 수 뽑기

"""
출처:프로그래머스,
https://school.programmers.co.kr/learn/courses/30/lessons/181858
"""

# 풀이 과정
def solution(arr, k):
result = []
for x in arr:
if x not in result and len(result) < k:
result.append(x)
else:
continue

if len(result) < k:
g = k - len(result)
for l in range(g):
result.append(-1)

return result