How to write a function to the task: "Write a function that returns the distance (Minkowski distance) of order p between two points whose coordinates are input arguments. The value of order p is default 2."?
def nth_root(value, n_root): root_value = 1/float(n_root) return round ((value) ** (root_value),3) def minkowski_distance(x,y,p=2): return nth_root(sum(pow(abs(ab),p) for a,b in zip(x, y)),p) print minkowski_distance([1, 1, 1], [3, 3, 0]) print minkowski_distanceprint minkowski_distance([2, 2, 3, 5], [6, 1, 8, 2], 4)