Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
6-liner: thanks wikipedia for the equations solution in Clear category for The Angles of a Triangle by Stensen
from math import sqrt, acos, degrees
is_valid_triangle = lambda a, b, c: False if (a + b <= c) or (a + c <= b) or (b + c <= a) else True
def checkio(a, b, c):
if not is_valid_triangle(a, b, c): return [0, 0, 0]
α, β, γ = map(degrees, [acos((a**2+b**2-c**2)/(2*a*b)), acos((b**2+c**2-a**2)/(2*b*c)), acos((c**2+a**2-b**2)/(2*c*a))])
return sorted(map(round, [α, β, γ]))
Oct. 23, 2020
Comments: