我有一个列表,其中包含从0
到的数字范围1
:
[0.01,0.1,0.4,0.034,0.6,0.7,0.9,1]
我如何能够编辑列表,以便所有数字从0-0.5
to0.4
并将所有数字从0.6-1
to更改0.7
,所以列表变为:
[0.4,0.40.40.4,0.7,0.7,0.7,0.7]
confindencenumbers = [(x=0.4) for x in confindencenumbers if x < 0.4]
confindencenumbers = [(x=0.7} for x in confindencenumbers if x > 0.5]