Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions distanceBetweenPoints.py
Original file line number Diff line number Diff line change
@@ -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='')
Empty file added divisibleByNumber.py
Empty file.