Skip to content

Commit c45cd89

Browse files
updates list comprehension
1 parent 5c469d6 commit c45cd89

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

basic-data-types/ListComprehension.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
1-
class Point:
2-
def __init__(self, x, y, z):
3-
self.x = x
4-
self.y = y
5-
self.z = z
6-
7-
def __str__(self):
8-
return "[" + str(x) + ", " + str(y) + ", " + str(z) + "]"
9-
10-
def comparator(self, other):
11-
if self.x == other.x:
12-
if self.y == other.y:
13-
if self.z < other.z:
14-
return -1
15-
elif self.z == other.z:
16-
return 0
17-
else:
18-
return 1
19-
elif self.y < other.y:
20-
return -1
21-
else: return 0
22-
else:
23-
if self.x < other.x:
24-
return -1
25-
else: return 1
26-
27-
281
x = int(input())
292
y = int(input())
303
z = int(input())
314
n = int(input())
325

33-
result = [[a, b, c] for a in range(x + 1) for b in range(y + 1) for c in range(z + 1) if a + b + c != n]
34-
print(result)
6+
print([[a, b, c] for a in range(x + 1) for b in range(y + 1) for c in range(z + 1) if a + b + c != n])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy