Python 리스트에서 짝수만 필터링

1 개요[ | ]

Python 리스트에서 짝수만 필터링
nums = [1, 2, 3, 4, 5]
filtered = [i for i in nums if i % 2 == 0]
print(filtered) # [2, 4]

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}