[Programmers] 나누어 떨어지는 숫자 배열
Python
def solution(arr, divisor):
answer = []
for i in arr:
if i % divisor == 0:
answer.append(i)
if answer:
return sorted(answer)
else:
return [-1]
def solution(arr, divisor):
answer = []
for i in arr:
if i % divisor == 0:
answer.append(i)
if answer:
return sorted(answer)
else:
return [-1]
댓글남기기