Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Triangle as array solution in Clear category for The Angles of a Triangle by U.V
from math import acos, degrees
def checkio(a, b, c):
ang = [0] * 3
tr = sorted([a, b, c])
if tr[0] + tr[1] <= tr[2]:
return ang
for i in range(3):
ang[i] = int(round( acos( (tr[(i-1)%3] ** 2 + tr[(i+1)%3] ** 2 - tr[(i)%3]**2) / (2*tr[(i-1)%3]*tr[(i+1)%3])) *degrees(1), 0))
return ang
Sept. 18, 2022
Comments: