Pythagoras Triplets
This Program name is Pythagoras Triplets. Write a Python program to Pythagoras Triplets
The below link contains Pythagoras Triplets question, explanation and test cases
https://drive.google.com/file/d/1pNIZ9mWA1pDZLf_KvKM8hDyZpHGcppyV/view?usp=sharing
We need exact output when the code was run
L = int(input())
triplets = []
for a in range(1, L + 1):
for b in range(1, L + 1):
for c in range(1, L + 1):
if a < b < c and a*a + b*b == c*c:
triplets.append((a, b, c))
print(len(triplets))
Comments
Leave a comment