title: '짝수의 합'
date: '2024-07-02'
tags: ["python", "짝수", "프로그래머스", "짝수의"]
summary: '짝수의 합'
---

![이미지](/images/self_dev/programmers/프로그래머스-Python-짝수의-합-html_20240702/img.png)

* * *

### **코드 입력**
```python
![이미지](/images/self_dev/programmers/프로그래머스-Python-짝수의-합-html_20240702/img_1.png)

짝수를 구할 땐, 2로 나누었을 때 나머지가 0인 경우를 구하면 된다.

n 이하의 짝수라고 했으니, n까지 루프문을 순회하면서 짝수일 경우 리스트에 담아준다.

그 다음, sum 연산자를 이용해서 합을 구한다.

* * *

> **🔗 [프로그래머스](https://school.programmers.co.kr/learn/courses/30/lessons/120831)**