Answer to Question #221736 in Python for Hari nadh babu

Question #221736

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

1
Expert's answer
2021-08-03T03:44:21-0400
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))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS