Python 价格=[.75,2.25,1.50,3.0,2.5,50,90,85,3.5]从列表中返回值>=2的最简单方法是什么

Python 价格=[.75,2.25,1.50,3.0,2.5,50,90,85,3.5]从列表中返回值>=2的最简单方法是什么,python,list,Python,List,价格=[.75,2.25,1.50,3.0,2.5,50,90,85,3.5]从列表中返回值>=2的最简单方法是什么 我在Github和google中看到了一些代码,但我无法开始工作。我正在学习如何用python 3编写代码 prices = [.75, 2.25, 1.50, 3.0, 2.5, .50, .90, .85 3.5] prince = sorted(i for i in j if i >= 2) print(j2) 我期待这个结果[2.25,2.5,3.0,3.5] 输

价格=[.75,2.25,1.50,3.0,2.5,50,90,85,3.5]从列表中返回值>=2的最简单方法是什么

我在Github和google中看到了一些代码,但我无法开始工作。我正在学习如何用python 3编写代码

prices = [.75, 2.25, 1.50, 3.0, 2.5, .50, .90, .85 3.5]
prince = sorted(i for i in j if i >= 2)
print(j2)
我期待这个结果[2.25,2.5,3.0,3.5]

输出:

[2.25, 2.5, 3.0, 3.5]

在python中,过滤列表的最简单方法是使用列表理解,您尝试过吗?有很多相关的问题。。。
[2.25, 2.5, 3.0, 3.5]