Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Angles solution in Clear category for The Angles of a Triangle by GregAS
import math
def round(val):
val1 = int(val)
val2 = (val - float(val1))*1000
if val2 > 499:
return val1+1
else:
return val1
def checkio(a, b, c):
check = sorted([a, b, c], reverse=True)
if(check[1]+check[2] <= check[0]): #is not a triangle
return [0, 0, 0]
su = a+b+c
su2 = su/2
area = ((su2)*(su2-a)*(su2-b)*(su2-c))**0.5
h = (2*area)/check[0]
sinA = h/check[1]
sinB = h/check[2]
A = round((math.asin(sinA)*360)/(2*math.pi))
B = round((math.asin(sinB)*360)/(2*math.pi))
C = 180 - A - B
return [A, B, C]
Jan. 4, 2018