list1 = [1, 2, 3, 4]
list2 = [2, 4, 6, 8, 10]
for i in range(min(len(list1), len(list2))):
if list1[i] == list2[i]:
print("Match found at index", i)
else:
print("No match found at index", i)
list1 = [1, 2, 3, 4]
list2 = [2, 4, 6, 8, 10]
for i, (a, b) in enumerate(zip(list1, list2)):
if a == b:
print("Match found at index", i)
else:
print("No match found at index", i)
import numpy as np
list1 = [1, 2, 3, 4]
list2 = [2, 4, 6, 8, 10]
array1 = np.array(list1)
array2 = np.array(list2[:len(list1)])
if np.array_equal(array1, array2):
print("Arrays are equal.")
else:
print("Arrays are not equal.")
下一篇:比较两个不同字典中的值