import numpy as np
a = [1,2,3,4,5,6]
b = [0.13,0.14,0.78,0.46,0.66,0.78]
a
Out[19]: [1, 2, 3, 4, 5, 6]
b
Out[20]: [0.13, 0.14, 0.78, 0.46, 0.66, 0.78]
a_array = np.array(a)
b_array = np.array(b)
result = a_array * b_array
result
Out[24]: array([0.13, 0.28, 2.34, 1.84, 3.3 , 4.68])
result.max()
Out[25]: 4.68
result.argmax()
Out[26]: 5
a[5]
Out[27]: 6
b[5]
Out[29]: 0.78
循环写法
max = 0
for i in range(6):
r = a[i] * b[i]
if r > max:
max = r
print(max)
4.68