-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathfile1.py
More file actions
42 lines (34 loc) · 885 Bytes
/
file1.py
File metadata and controls
42 lines (34 loc) · 885 Bytes
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
orderedPairsSet = set()
def sum(x,y):
return x + y
def div(x,y):
if (x % y == 0):
return True
else:
return False
def checkPair(x,y,p,q):
if(sum(x,y) > p and sum(x,y) < q and div(y,x)==True):
orderedPairsSet.add((x,y))
return True
else:
return False
def myRelation(p,q):
if(p < q and p > 3 and q > 4):
print("myRelation(%d, %d)" % (p,q))
x = 1
y = 2
checkPair(x,y,p,q)
while (x <= p and y <= q):
if (y+2 > q):
y = 2
x = x+2
checkPair(x,y,p,q)
else:
y = y+2
checkPair(x,y,p,q)
print("List:")
print(sorted(orderedPairsSet))
else:
print("invalid input")
myRelation(5,10)
myRelation(6,15)