我想知道是否可以在 Dictionary 上运行循环以检查它的值是否在给定列表索引的范围内,就像我有一本字典一样:
fitness_prob with this values: {<Individual.Individual object at 0x000001A7F5A4BCF8>: 2.7073187389600226e-07, <Individual.Individual object at 0x000001A7F5A4BCC0>: 2.9819203163310753e-07, <Individual.Individual object at 0x000001A7F5A78160>: 3.2173549856232664e-07, <Individual.Individual object at 0x000001A7F5A78198>: 2.643299134420016e-07, <Individual.Individual object at 0x000001A7F5A781D0>: 2.94518321996265e-07}
和一份清单
points[] : [1.0027919514838946e-05, 0.010010027919514839, 0.02001002791951484, 0.030010027919514837, 0.04001002791951484, 0.050010027919514845, 0.06001002791951484, 0.07001002791951484, 0.08001002791951484]
列表就像一个刻度,其值作为标记,循环应该识别那些标记范围内的字典值。喜欢 :
预期输出:
首先,检查 points[0] 和 points[1] 的范围
其次,将所有来自 Fitness_prob{} 的值添加到新字典中
key
:value
new_pool{}
湖上湖
相关分类