Solve Problems by Coding Solutions - A Complete solution for python programming
import numpy as np
def cityblock_distance(A, B):
result = np.sum([abs(a - b) for (a, b) in zip(A, B)])
return result
if __name__== "__main__":
arr1 = [5,2]
arr2 = [1,5]
result = cityblock_distance(arr1, arr2)
print(result)
Post a Comment
No comments:
Post a Comment