22

 import cProfile


def find_pythagorean_triples(limit):

    triples = []

    for a in range(1, limit):

        for b in range(a, limit):

            c = (a**2 + b**2) ** 0.5

            if c.is_integer():

                triples.append((a, b, int(c)))

    return triples


cProfile.run('find_pythagorean_triples(100)')


Comments