Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
A bit of math with normal rounding solution in Clear category for The Angles of a Triangle by swagg010164
from typing import List
from math import acos, degrees
def rounder(a):
if a - int(a) >= 0.5:
return (int(a) + 1)
return int(a)
def checkio(a: int, b: int, c: int) -> List[int]:
if a + b <= c or a + c <= b or b + c <= a:
return [0, 0, 0]
first_angle = rounder(degrees(acos((b*b + c*c - a*a)/(2*b*c))))
second_angle = rounder(degrees(acos((b*b + a*a - c*c)/(2*b*a))))
third_angle = 180 - first_angle - second_angle
answer = [first_angle, second_angle, third_angle]
answer.sort()
return answer
Dec. 8, 2019
Comments: