From 237c1162533fe4da56e4c89ac244c95c8516f1a6 Mon Sep 17 00:00:00 2001 From: steven-y-e Date: Mon, 31 Jul 2023 14:17:27 -0400 Subject: [PATCH] feat(solution): problem #9 --- solutions/009/specialpythagoreantriplet.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 solutions/009/specialpythagoreantriplet.py diff --git a/solutions/009/specialpythagoreantriplet.py b/solutions/009/specialpythagoreantriplet.py new file mode 100644 index 0000000..dc45ffb --- /dev/null +++ b/solutions/009/specialpythagoreantriplet.py @@ -0,0 +1,23 @@ +def is_pythagorean_triplet(a, b, c): + if (a * a + b * b) == (c * c): + return True + else: + return False + +tripletFound = False + +for i in range(1,500): + for j in range(1,500): + for k in range(1,500): + if is_pythagorean_triplet(i, j, k): + print("triplet:",i,j,k) + if i+j+k == 1000: + print("The product of abc is: " + str(i*j*k)) + tripletFound = True + if tripletFound: + break + if tripletFound: + break + if tripletFound: + break +