Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Angles of a Triangle by arek.kowalski107
from math import acos
from math import pi
def checkio(a, b, c):
edges = [a, b, c]
edges.sort()
if edges[0] + edges[1] <= edges[2]:
return [0, 0, 0]
ang1 = round(acos((edges[1] ** 2 + edges[2] ** 2 - edges[0] ** 2) / float(2 * edges[1] * edges[2]))/pi*180)
ang2 = round(acos((edges[0] ** 2 + edges[2] ** 2 - edges[1] ** 2) / float(2 * edges[0] * edges[2]))/pi*180)
ang3 = 180 - ang1 - ang2
return [ang1, ang2, ang3]
Dec. 14, 2016