Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you will need to create a Python fruitful function (a fruitful function is one that returns a value) called kind(a, b, c)

In this assignment you will need to create a Python fruitful function (a fruitful function is one that returns a value) 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

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

Language in Context?

Answered: 1 week ago