Skip to content

Commit

Permalink
🔨 feat(lib): Simple task 9 implementation in python
Browse files Browse the repository at this point in the history
  • Loading branch information
worthant committed Oct 15, 2024
1 parent 6749a84 commit bee55f6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/task9/simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def find_pyth_triplet(sum_):
for a in range(1, sum_):
for b in range(1, sum_):
c = 1000 - a - b
if a**2 + b**2 == c**2:
return a, b, c


a, b, c = find_pyth_triplet(1000)
print(f"Pythagorean triplet: a = {a}. b = {b}, c = {c}")
print(f"Product abc = {a * b * c}")

0 comments on commit bee55f6

Please sign in to comment.