Question: Solve the following in python: If you are given three sticks, you may or may not be able to arrange them in a triangle. For

Solve the following in python:
If you are given three sticks, you may or may not be able to arrange them in a triangle. For example,
if one of the sticks is 12 inches long and the other two are one inch long, you will not be able to get
the short sticks to meet in the middle. For any three lengths, there is a simple test to see if it is
possible to form a triangle: If any of the three lengths is greater than the sum of the other two, then
you cannot form a triangle. Otherwise, you can. (If the sum of two lengths equals the third, they form
what is called a degenerate triangle.)
Write a program that prompts the user to input three stick lengths and prints to the screen whether
you can or cannot form a triangle from these sticks. The message should specify when a degenerate
triangle is formed. The following are three examples of program input/output:
Enter the lengths of three sticks:
Length of the first stick: 3
Length of the second stick: 4
Length of the third stick: 5
The sticks can form a triangle.
Enter the lengths of three sticks:
Length of the first stick: 1
Length of the second stick: 2
Length of the third stick: 3
The sticks form a degenerate triangle.
Enter the lengths of three sticks:
Length of the first stick: 3
Length of the second stick: 2
Length of the third stick: 7
The sticks cannot form a triangle.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!