我需要一个代码帮助,基本上我得到了一个数字列表,然后我想从该列表中减去,然后从该列表中除以答案,然后将其添加到列表中的原始数字上以显示回答
M = [99]
N = 8
Max = M`enter code here`
for i in range(len(M)):
M[i] = M[i] - N
M[i] = M[i] // N + M[i]
print(M)
答案 0 :(得分:0)
也许您想要的是以下示例的组合:
import numpy as np
original_list = np.array([1,5,7,4,2]) # your original list
subtract_list = original_list-5 # subtract some number
divide_list = subtract_list/3.0 # divide by some number
final_list = original_list + divide_list # add to the original
print (final_list)