From 3b029efa53dc4b3dfa60c989502aa3245821a027 Mon Sep 17 00:00:00 2001 From: "LAPTOP-PIGVD7CM\\Komal" <99kkaur@gmail.com> Date: Tue, 20 Oct 2020 12:04:22 +0530 Subject: [PATCH 1/2] numbers divisible by given no --- divisibleByNumber.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 divisibleByNumber.py diff --git a/divisibleByNumber.py b/divisibleByNumber.py new file mode 100644 index 0000000..e69de29 From 3ddff314b403b231b17f7b52d175daa7497489c3 Mon Sep 17 00:00:00 2001 From: "LAPTOP-PIGVD7CM\\Komal" <99kkaur@gmail.com> Date: Tue, 20 Oct 2020 12:23:04 +0530 Subject: [PATCH 2/2] distance between two points --- distanceBetweenPoints.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 distanceBetweenPoints.py diff --git a/distanceBetweenPoints.py b/distanceBetweenPoints.py new file mode 100644 index 0000000..04f4324 --- /dev/null +++ b/distanceBetweenPoints.py @@ -0,0 +1,25 @@ +import math +n = int(input("enter number of direction to move")) +x1 = 0 +y1 = 0 +x2 = 0 +y2 = 0 +for i in range(n): + dirn = input("enter direction (eg:LEFT,UP,DOWN,RIGHT) ") + step = input("enter no of steps in that directions") + steps = int(step) + if (dirn == "LEFT"): + x2 = x2 - steps + y2 = y2 + elif (dirn == "UP"): + x2 = x2 + y2 = y2 + steps + elif (dirn == "RIGHT"): + x2 = x2 + steps + y2 = y2 + elif (dirn == "DOWN"): + x2 = x2 + y2 = y2 - steps +temp=((x2-x1)*(x2-x1)) + ((y2-y1)*(y2-y1)) +distance=math.sqrt(temp) +print("distance from tarting point = ", round(distance), "steps", end='') \ No newline at end of file