-
Notifications
You must be signed in to change notification settings - Fork 0
/
point_generator_lists.py
52 lines (44 loc) · 1.45 KB
/
point_generator_lists.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
__author__ = 'Guruguha'
# List comprehensions
x = input()
y = input()
z = input()
N = input()
def point_generator(x,y,z,N):
x = int(x)
y = int(y)
z = int(z)
N = int(N)
point_co_ord = []
list_of_points = []
for i in range(0, x+1):
for j in range(0, y+1):
sum_ij = i + j
for k in range(0, z+1):
sum_jk = j + k
sum_ik = i + k
sum_ijk = sum_ij + k
if sum_ijk != N:
point_co_ord.append(i)
point_co_ord.append(j)
point_co_ord.append(k)
list_of_points.append(point_co_ord)
sum_ijk = sum_jk + i
if sum_ijk != N:
point_co_ord.append(i)
point_co_ord.append(j)
point_co_ord.append(k)
list_of_points.append(point_co_ord)
sum_ijk = sum_ik + j
if sum_ijk != N:
point_co_ord.append(i)
point_co_ord.append(j)
point_co_ord.append(k)
list_of_points.append(point_co_ord)
required_points = list_of_points[0]
group_of_points = [required_points[i:i + 3] for i in range(0, len(required_points), 3)]
subset_of_points = []
for i in range(0,len(group_of_points),3):
subset_of_points .append(group_of_points[i])
print(subset_of_points)
point_generator(x,y,z,N)