Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jackfrued
GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/公开课/年薪50W+的Python程序员如何写代码/code/Python/opencourse/part02/idiom05.py
3078 views
1
data = [7, 20, 3, 15, 11]
2
3
# result = []
4
# for i in data:
5
# if i > 10:
6
# result.append(i * 3)
7
8
result = [num * 3 for num in data if num > 10]
9
print(result)
10
11