Ad

Shortened to one line

Code
Diff
  • def find_triple(a, b):
        return sorted([a**2+b**2, a**2-b**2, 2*a*b])
    • def find_triple(a, b):
    • ans1 = a**2 + b**2
    • ans2 = a**2 - b**2
    • ans3 = 2 * a * b
    • triple = [ans1, ans2, ans3]
    • triple.sort()
    • return triple
    • return sorted([a**2+b**2, a**2-b**2, 2*a*b])