Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 202 Bytes

python.md

File metadata and controls

16 lines (11 loc) · 202 Bytes

python

Comprehensions

List

new_list = [expression(i) for i in old_list if filter(i)]

Dictionary

>>> d = {n: n**2 for n in range(5)}
{0: 0, 1: 1, 2: 4, 3: 9, 4: 16}