pythagorean triplet

This commit is contained in:
Xevion
2020-11-15 09:25:11 -06:00
parent 7237f622d7
commit 5d4915219c
4 changed files with 151 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
def is_triplet(triplet):
return (triplet[0]**2 + triplet[1]**2) == triplet[2]**2
def triplets_with_sum(number):
triplets = []
for a in range(number):
for b in range(number):
for c in range(number):
# if a + b + c == number:
# if is_triplet((a, b, c)):
triplets.append((a, b, c))
return triplets
x = triplets_with_sum(10001)
print(len(x))
def triplets_in_range(start, end):
return