Python-100-Days/公开课/文档/年薪50W+的Python程序员如何写代码/code/Python/opencourse/part02/idiom05.py

10 lines
168 B
Python

data = [7, 20, 3, 15, 11]
# result = []
# for i in data:
# if i > 10:
# result.append(i * 3)
result = [num * 3 for num in data if num > 10]
print(result)