-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBVV_ISaP-13_PW-35.2.py
46 lines (33 loc) · 1.06 KB
/
BVV_ISaP-13_PW-35.2.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
#Practical Work 35
#2 Problem
import random
points = []
def find_distanse_midle_two_points(point1, point2):
distanse = (( point1[0] - point2[0])**2 + (point1[1] - point2[1])**2)**0.5
return distanse;
count_of_rnd_points = None;
while count_of_rnd_points == None:
try:
count_of_rnd_points = int(input("Enter count of random points: "))
if count_of_rnd_points < 2:
count_of_rnd_points = None
raise
except:
print("\nUncorrect input!\n")
for i in range(count_of_rnd_points):
points += [[random.randint(-10, 10), random.randint(-10, 10)]]
print(f"{i+1}: \t{points[i]}")
max_distanse = 0;
most_remote_points = [[],[]]
for i in points:
for j in points:
_distanse = find_distanse_midle_two_points(i, j)
if _distanse > max_distanse:
max_distanse = _distanse;
most_remote_points[0] = i;
most_remote_points[1] = j;
print(f'''
Max distanse between two points: {max_distanse}
Points: {most_remote_points}
''')
input()