Type of Triangle
Is acute, obtuse , right?
Is isos, scalene, equalat?
line = input('Enter three sides: ')
sides = [float(s) for s in line.split()]
sides.sort()
if sides[0] + sides[1] <= sides[2]:
print('It is nit a triangle')
exit()
if sides[0]**2 + sides[1]**2 < sides[2]**2:
angle = 'obtuse'
elif sides[0]**2 + sides[1]**2 > sides[2]**2:
angle = 'acute'
else:
angle = 'right'
if sides[0] == sides[2] :
form = 'equalat'
elif sides[0] == sides[1] or sides[1] == sides[2]:
form = 'isos'
else:
form = 'scalene'
print('It is', angle, form, 'triangle')
Comments
Leave a comment