下午好,
我对Python还是很陌生,我必须解决一个需要尝试数十亿个假设的问题...更具体地说,我需要迭代440个元素的列表,但我需要这样做8次...(是的,我知道OS迭代的次数完全是疯狂的。
我的机器相当不错,所以我想使用多处理python功能来加快速度。
您是否知道任何简单的解决方案可以从我的机器的处理能力中获利?
输入:
配对对:
for ind1 in range(16,37):
for ind2 in range(16,37):
ListPairsAux = []
ListPairsAux.append(ind1)
ListPairsAux.append(ind2)
ListPairs.append(ListPairsAux)
为了简化问题,您可以假设len(list1 [i])和len(list2 [i])都是整数,并且都等于198。(在实际问题中,我们实际上有21个不同的整数,但是都以相同的顺序排列-这意味着它们不会超出198。
for循环如下:
for first in ListPairs:
print(str(first))
for second in ListPairs:
for third in ListPairs:
for fourth in ListPairs:
for fifth in ListPairs:
for sixth in ListPairs:
for seventh in ListPairs:
sumA = first[0] + second[0] &#