Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
AngTriang solution in Clear category for The Angles of a Triangle by Seaclaid
import math
def checkio(a, b, c):
odp=[0, 0, 0]
p=(a+b+c)/2
if ac-b:
pole=math.sqrt(p*(p-a)*(p-b)*(p-c))
power=[a**2,b**2,c**2,a**2,b**2]
mian=[a,b,c,a,b]
for i in range(3):
cosx=(power[i+1]+power[i+2]-power[i])/(2*mian[i+1]*mian[i+2])
if cosx>1:
cosx=cosx-1
kat=math.degrees(math.acos(cosx))
if (kat-int(kat))>=0.5:
odp[i]=math.ceil(kat)
else:
odp[i]=int(kat)
odp.sort()
print(odp)
return odp
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(4, 4, 4) == [60, 60, 60], "All sides are equal"
assert checkio(3, 4, 5) == [37, 53, 90], "Egyptian triangle"
assert checkio(2, 2, 5) == [0, 0, 0], "It's can not be a triangle"
Jan. 8, 2017