Answer to Question #320889 in Python for leigh

Question #320889

Type of Triangle


Is acute, obtuse , right?

Is isos, scalene, equalat? 


1
Expert's answer
2022-04-02T10:00:08-0400
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')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS