Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clear and Easy <===== comment what do you think solution in Clear category for The Angles of a Triangle by piotr.sawicki
def checkio(a, b, c):
import math
list_of_sides = [a,b,c]
# it's condition which check does triangle could be constructed
if max(list_of_sides) >= (sum(list_of_sides) - max(list_of_sides)):
return [0, 0, 0]
else:
# equations base on the cosine rule
first_angle = int(round((180/math.pi)*math.acos((c**2 + b**2 - a**2)/(2*c*b)),0))
second_angle = int(round((180/math.pi)*math.acos((c**2 + a**2 - b**2)/(2*c*a)),0))
third_angle = 180-first_angle-second_angle
return sorted([first_angle, second_angle, third_angle])
Oct. 31, 2017