Python Tuples exercise [SPOILER]
Hey everyone, I've been stuck in this exercise for half a day. Here's the exercise: You are given coordinates of 2 points and need to find the straight line distance between them. The coordinates are provided in a tuple, for example: p = (8, 11) PY The first value represents the x coordinate, while the second value represents the y coordinate of the point p. Complete the provided code to calculate and output the distance between the two given points. The linear distance is the square root of the square of the horizontal distance plus the square of the vertical distance between two points. The math.sqrt() function can be used to calculate the square root. This is what I tried: import math p1 = (23, -88) p2 = (6, 42) #your code goes here P1 = p1[0]**2 + p1[1]**2 P2 = p2[0]**2 + p2[1]**2 print(P1) print(P2) print(math.sqrt(P1+P2)) P1 = math.sqrt(p1[0]**2 + p1[1]**2) P2 = math.sqrt(p2[0]**2 + p2[1]**2) print(P1+P2) # 1st block output: 100.36433629531956 # 2nd block output: 133.38244020598597 The expected output: 131.10682667199293 I'm not that far from the result but stills isn't what is expected. Anyone, know what am I doing wrong?