Calculate Distance Between Two Points
Welcome to the world of coordinates and geometry! In this fun challenge, we'll explore how to calculate the distance between two points on a plane.
Imagine you are on a treasure map, looking to find the distance between two treasures marked on the map. These treasures are defined by their coordinates (x, y). To find out how far apart they are, we will use a little bit of math magic!
The distance between two points ((x_1, y_1)) and ((x_2, y_2)) is found using the distance formula:
[ d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} ]
Your task is to implement a Python function that accepts the coordinates of two points and returns the distance between them. Don't worry about taking any inputs from the user or printing anything. Just focus on implementing the function and returning the correct distance value.
Example
Here are a few examples of how the function should behave:
calculate_distance((0, 0), (3, 4)) # Returns: 5.0 calculate_distance((1, 1), (4, 5)) # Returns: 5.0 calculate_distance((-1, -1), (-4, -5)) # Returns: 5.0 calculate_distance((0, 0), (0, 0)) # Returns: 0.0
Get ready to explore the plane and calculate some distances!
Inputs
Arg 1:
[0,0]Arg 2:
[3,4]Expected Output
5.0Actual Output