[Programmers] - 두 개 뽑아서 더하기 (Level 1)
월간 코드 챌린지 시즌1
LEVEL : 1
numbers = [2,1,3,4,1]
def solution(numbers):
all_sum = []
for i in range(len(numbers)-1):
for j in range(i+1, len(numbers)):
all_sum.append(numbers[i]+numbers[j])
answer = list(set(all_sum))
answer.sort()
return answer
solution(numbers)
[2, 3, 4, 5, 6, 7]
Comments