【发布时间】:2019-05-28 07:33:37
【问题描述】:
final 是 4 行的 numpy 数组,我需要从嵌套的 while 循环中获取所有值,但此代码只返回最终的第一行或循环的第一次迭代。
def amir2 (final):
i = 0
j = 0
temp = []
temp2 = []
temp3 = []
while i < len(final):
while j < len(final):
cos_lib = coss(final[i] , final[j])
temp.append(cos_lib)
j += 1
temp2.append(temp)
i += 1
return temp2
【问题讨论】:
-
将您的输入和预期输出添加到问题中。而不是告诉while循环的输出,最好解释一下你在while循环中做什么。可能会有更好的方法来做同样的事情。
-
coss()是什么?