Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 3fd7f62

Browse files
authored
Update 4_pytha.py
1 parent 5bc8981 commit 3fd7f62

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

4_pytha.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
for a in range(0,1000):
2-
for b in range(0,1000):
3-
for c in range(0,1000):
4-
if a**2 + b**2==c**2 and a+b+c==1000:
5-
if a<b<c:
6-
print a*b*c
7-
exit()
8-
9-
1+
def pytha(a, b, c):
2+
return (a**2) + (b**2) == (c**2)
3+
4+
sum = 1000
5+
6+
for i in range(1, sum):
7+
for j in range(i+1, sum):
8+
c = sum - (i + j)
9+
if(pytha(i, j, c)):
10+
if i + j + c == sum:
11+
print i * j * c
12+
break
13+
14+

0 commit comments

Comments
 (0)