codegamy_logo

CODELAB

4. Calculate the Distance Between Two Points

Given two points (x1, y1) and (x2, y2) on a 2D plane, calculate the distance between them using the distance formula:

Distance = √((x2 - x1)² + (y2 - y1)²)

Refer to the image below for illustration:

Distance Between Two Points Illustration

Input Format

Four space-separated integers: x1 y1 x2 y2.

Output Format

A single floating-point number representing the distance between the two points.

Sample Input

3 2 7 8

Sample Output

7.211

Constraints:

  • -103 ≤ x1, y1, x2, y2 ≤ 103
Python
Dark
14

Custom Input

Output

Custom Input

Output

4. Calculate the Distance Between Two Points

Given two points (x1, y1) and (x2, y2) on a 2D plane, calculate the distance between them using the distance formula:

Distance = √((x2 - x1)² + (y2 - y1)²)

Refer to the image below for illustration:

Distance Between Two Points Illustration

Input Format

Four space-separated integers: x1 y1 x2 y2.

Output Format

A single floating-point number representing the distance between the two points.

Sample Input

3 2 7 8

Sample Output

7.211

Constraints:

  • -103 ≤ x1, y1, x2, y2 ≤ 103
Python
Dark
14

Custom Input

Output

Custom Input

Output

2025 © CodeLab(PSTU) | All Rights Reserved.

Developed by Hasib-17❤️