[Python] Comprehension
Comprehension사전적 의미 : 이해, 이해력, 포용, 포용력, 포함, 압축 ..python 에서 사용되는 comprehension 은 여러 자료형(list, dictionary, set) 에서 사용된다.List Comprehension 반복되거나 특정 조건을 만족하는 List 를 보다 쉽게 만들어 내기 위한 방법. 1. 반복문을 사용한 Comprehension[i for i in range(4)]# [0, 1, 2, 3][i * 2 for i in range(4)]# [0, 2, 4, 6][i + 3 for i in range(4)]# [0, 4, 5, 6] 2. 조건문을 사용한 Comprehension[i for i in range(10) if i % 2 == 0]# [0, 2, 4, 6, 8..
2025. 1. 10.