-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDers6_1.py
More file actions
75 lines (46 loc) · 1.11 KB
/
Ders6_1.py
File metadata and controls
75 lines (46 loc) · 1.11 KB
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
# coding: utf-8
# In[1]:
import math
#uzayda iki nokta arasında uzaklık
def myDistance(a,b):
mypoint_1=a
mypoint_2=b
a=(myPoint_1[0]-myPoint_2[0])**2
b=(myPoint_1[1]-myPoint_2[1])**2
return math.sqrt(a+b)
# In[2]:
myPoint_1=[0,0]
myPoint_2=[1,0]
myPoint_3=[0,1]
myPoint_4=[1,1]
# In[3]:
myDistance(myPoint_2,myPoint_3)
# In[4]:
a=myPoint_1[0]+myPoint_2[0]+myPoint_3[0]+myPoint_4[0]
b=myPoint_1[1]+myPoint_2[1]+myPoint_3[1]+myPoint_4[1]
center_Point=[a/4,b/4]
center_Point
# In[10]:
#4 tane noktanın orta noktasını bulma
def findCenter(List_Of_Points):
a=0
b=0
for point in List_Of_Points:
#her yeni pointle karsılastıkca a ve b degerleri
a=a+point[0]
b=b+point[1]
l=len(List_Of_Points) #gelen listenin uzunlugunu al
return[a/l,b/l] # a'yı gelen listenin uzunluguna bol
# In[11]:
myPoint_1=[0,0]
myPoint_2=[1,0]
myPoint_3=[0,1]
myPoint_4=[1,1]
# In[12]:
my_Point_List=[]
my_Point_List.append(myPoint_1)
my_Point_List.append(myPoint_2)
my_Point_List.append(myPoint_3)
my_Point_List.append(myPoint_4)
center=findCenter(my_Point_List)
center