
진짜 쉬운풀이
0부터 9까지 합이 45라는걸 아는 경우는 쉽게 구할 수 있음
def solution(numbers):
return 45 - sum(numbers)
def solution(numbers):
total = 0
for i in range(0,10):
if i not in numbers:
total += i
return total
for문으로 푸는 경우
numbers에 없는 수를 구할때는 if i not in numbers를 사용하면 쉽게 구할 수 있음 ! ㅠ
'코딩테스트 > Python' 카테고리의 다른 글
| [프로그래머스/Python] 서울에서 김서방 찾기 (0) | 2025.09.24 |
|---|---|
| [프로그래머스/Python] 나누어 떨어지는 숫자 배열 (0) | 2025.09.24 |
| [프로그래머스/Python] 음양 더하기 (0) | 2025.09.24 |
| [프로그래머스/Python] 하샤드 수 (0) | 2025.09.24 |
| [프로그래머스/Python] 정수 제곱근 판별 (0) | 2025.09.23 |