Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given 3 integers as lengths they may or may not be able to form a triangle. For example, if the lengths are 1, 2, 33,

Given 3 integers as lengths they may or may not be able to form a triangle. For example, if the lengths are 1, 2, 33, then its easy to see that no triangle can be created with those lengths for sides. The lengths 3, 4, 5 will create a triangle a right triangle, one containing a 90-degree angle. You will need to create a Python fruitful function called kind(a, b, c) which yields an integer. The lengths of the side are a, b, and c. The function returns as follows: 0 No triangle can be created 1 The triangle is equilateral (all three sides are the same length) 2 The triangle is isosceles (two sides are the same length, but not all three) 3 The triangle is a right triangle (a2 + b2 = c2) 4 The triangle acute (all the angles in the triangle are less than 90 degrees) 5 The triangle is obtuse (none of the above cases apply)

Write a function called name(k) that accepts a kind value and returns the name of this kind of triangle. The names are: no triangle, equilateral, isosceles, right, acute, and obtuse.

Write a main driving program that repeatedly accepts 3 integers from the user and then reports what kind of triangle (if any) can be formed. It should use kind() and name() to accomplish this. You must not assume that the lengths always will be input in non-decreasing order. Your program should continue to request inputs until any one of the lengths is less than one. Demonstrate your program works by giving it these lengths plus at least 3 more of your own selection. 1, 2, 33 5, 5, 5 6, 6, 4 3, 4, 5 7, 8, 9 4, 5, 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions