Read 3 integer numbers from the user; these numbers represent the lengths of 3 straight lines. From the 3 lengths, determine whether a triangle can be formed with the corresponding lines. If it is possible to form a triangle, determine whether the triangle is a right triangle or not. The rules to be used are: 1. To form a triangle where all lines’ ends meet (form vertices), the sum of the lengths of two sides must be greater than the length of the third side. This short video illustrates this concept: How to determine if the three sides make up a triangle. 2. Per the Pythagorean theorem: in a straight triangle, the square of the length of the longest side (the hypotenuse) is equal to the sum of the squares of the lengths of the other two sides. 3. The user can enter the lengths of each line in any order, i.e.: you may not assume that the first length is the longest or the smallest or the middle value.

Answers

Answer 1

Answer:

Written in Python

print("Enter three sides of a triangle: ")

length = []

for i in range(0,3):

    inp = int(input(""))

    length.append(inp)    

length.sort()

if length[1]+length[2] > length[0] and length[0] + length[2] > length[1] and length[0] + length[1] > length[2]:

    print("Triangle")

    if length[2]**2 == length[0]**2 + length[1] **2:

         print("Right Angled")

    else:

         print("Not Right Angled")

else:

    print("Not Triangle")

Step-by-step explanation:

This line prompts user for sides of triangle

print("Enter three sides of a triangle: ")

This line declares an empty list

length = []

The following iteration gets user input

for i in range(0,3):

    inp = int(input(""))

    length.append(inp)    

This line sorts user input

length.sort()

The following if condition checks if user input is triangle

if length[1]+length[2] > length[0] and length[0] + length[2] > length[1] and length[0] + length[1] > length[2]:

The following is executed is the if condition is true

    print("Triangle")

The following if condition checks if user input forms a right angled triangle

    if length[2]**2 == length[0]**2 + length[1] **2:

         print("Right Angled")

    else:

         print("Not Right Angled")

This is executed if user input is not a triangle

else:

    print("Not Triangle")


Related Questions

the first 5 multiples of 18 after 0 are?​

Answers

Answer:

18,36,54,72,90 are first five multiples of 18

Step-by-step explanation:

Answer:

18,36,54,72,90

Step-by-step explanation:

4(3x + 1)
What is the answer to 4(3x + 1)

Answers

12x + 4

Divide 12 by 4

X=3

Answer:

Answer is 12x+4. Hope that helped.

Other Questions
Put the following fractions in order from least to greatest, 1/8 2/5, 3/5, 1/6 1/4, 2/3, 1/3 HELP MEEEEEEEEEEEE ASAP What is the difference between a "sprain" and a "strain?"A) A "sprain" is an injury to a ligament while a "strain" is an injury to a muscle or tendon.B) A "strain" is an injury to a ligament while a "sprain" is an injury to a muscle or tendon.C)Neither options are correct. Complete the dialogue with the present perfect or past simple form of the verbs in brackets.Jack: How long ______ (your dad/be) collecting musical instruments, Kate?Kate: He _____ (begin) collecting them in the 1980s. Now he's got 1500 instruments.Jack: That's amazing! Does he keep them all at home?Kate: Yes. But we _____ (just/ move) to a bigger house because we ____ (not have) enough space for this collection in our old place.Jack: What is his favourite musical instrument in the collection?Kate: He _____ (buy) many amazing instruments, but I think his favourite is a Navajo drum. My dad ______ (find) it in Arizona about five years ago. The plan for surveying land set up by the Ordinance of 1785 is no longer used. True FalseQuestion 2 (1 point)The Northwest Ordinance ________________. apermitted slavery bhalted settlement cfreed all slaves doutlawed slaveryQuestion 3 (1 point)The Confederation Congress could not pass a law unless all of the states agreed to it. True FalseQuestion 4 (1 point)In some states, the governor was elected by the legislature. True FalseQuestion 5 (1 point)The Confederation of States was unsuccessful because ___________. ait was too powerful bit followed English law cit was too limited in its power dit taxed the states too muchQuestion 6 (1 point)The rights listed in the states' bill of rights had their origins in English law. True FalseQuestion 7 (1 point)The Confederation of States had the power to ____________. apass laws without the states' approval brepresent the states with foreign countries cassign governors to the states dbring slaves to the states from AfricaQuestion 8 (1 point)After Shays's Rebellion, the states decided they wanted______________. aa less powerful federal government ba more powerful federal government cto pay less taxes to the federal government dfinancial help from the federal governmentQuestion 9 (1 point)After the American Revolution, the population in the Northwest Territory ______________. ashrank considerably bstayed stable cgrew a little bit dgrew dramaticallyQuestion 10 (1 point)If a state did not follow a law passed by the Confederation Congress _____________. athe state would be punished bthe state would be taxed cnothing would happen to the state dthe state's governor would be replaced What is the role of DNA polymerase in DNA replication? A. It ties the chunks of DNA together.B. It creates the replication fork. C. It checks the DNA for errors.D. It breaks apart the bases. While making some observations at the top of the 66 m tall Astronomy tower, Ronaccidently knocks a 0.5 kg stone over the edge. How long will a student at the bottomhave to get out of the way before being hit? Item 3Which words best describe Dr. Mesmer?A.humble, kind, and wiseB.simple, plain, and directC.fast, daring, and strongD.elegant, fancy, and mysterious Which of these did Progressives support?A. AlcoholismB. GraftC. ProstitutionD. Direct election of senatorsapex btw Needing help with poetry please????? ANSWER THE QUESTION FAST!!!! THE ONES WHO ANSWER WILL BE MARKED BRAINLIEST!!!!!!!!Confucius has played an essential role in influencing the mindset of the people .Justify the statement.ASAP what 3+6+9answer 4 pointss 3 5 of students at a school are boys. If there are 2610 students at the school, how many are girls? A regional automobile dealership sent out fliers to prospective customers indicating that they had already won one of three different prizes: an automobile valued at $28 comma 000, a $100 gas card, or a $5 shopping card. To claim his or her prize, a prospective customer needed to present the flier at the dealership's showroom. The fine print on the back of the flier listed the probabilities of winning. The chance of winning the car was 1 out of 31 comma 248, the chance of winning the gas card was 1 out of 31 comma 248 comma and the chance of winning the shopping card was 31 comma 246 out of 31 comma 248. Complete parts (a) through (c). What is located after the initiating Incident but before the climax? Can an 8/8 affect your grade (I have a B) Highlight what happens to Cabeza de Vaca in paragraph 16. How do I write 4,332 in scientific notation?? Sharon wants to open a checking account from which to pay bills. She wants online services, and a debit card, which both banks provide for free. Based upon past experience, she expects to accidentally overdraft the account 1 time per year, due to unexpected charges and miscommunications. She expects no 2nd copies of statements, and to use network ATMs 4 times per month with either bank. She has $3300 in an emergency savings account at First State Bank, and thinks that the balance will be enough to cover overdrafts in the future if automatic transfers are made when needed. Alma was given some money as a gift and deposited it into a savings account. She makes a withdrawal of the same amount at the end of each month. At the end of the 5th month, her balance was $442. At the end of the 13th month, her balance was $226.