forked from NeilMitra/Nearest-Neighbour-Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnearestneighbour.py
77 lines (44 loc) · 1.02 KB
/
nearestneighbour.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import math as m
#funtions
def distanceformulafs():
return float(m.sqrt( ((y2-y1)**2) + ((x2-x1)**2)))
def distanceformulaft():
return float(m.sqrt( ((ya2-y1)**2) + ((xa2-x1)**2)))
print("Enter your two starting coordinates:")
sp = []
for i in range(0, 2):
x = int(input())
sp.append(x)
print(sp)
x1 = (sp[0])
y1 = (sp[1])
print("What is your second coordinate?:")
sc = []
for i in range(0, 2):
x = int(input())
sc.append(x)
print(sc)
x2 = (sc[0])
y2 = (sc[1])
print("What is your third coordinate?:")
tc = []
for i in range(0, 2):
x = int(input())
tc.append(x)
print(tc)
xa2 = (tc[0])
ya2 = (tc[1])
print("What is your fourth coordinate?:")
fc = []
for i in range(0, 2):
x = int(input())
fc.append(x)
print(fc)
xb2 = (fc[0])
yb2 = (fc[1])
a = distanceformulafs()
b = distanceformulaft()
"""
porject is on pause at the moment, please check out other code that I have written on
my GitHub: https://www.github.com/NeilMitra
"""