1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Advocard [28]
3 years ago
6

Input 3 positive integers from the terminal, determine if tlrey are valid sides of a triangle. If the sides do form a valid tria

ngle, output the type of triangle - equilateral, isosceles, or scalene - and the area of the triangle. If the three integers are not the valid sides of a triangle, output an appropriats message and the 3 sides. Be sure to comment and error check in your progam.
Computers and Technology
1 answer:
butalik [34]3 years ago
4 0

Answer:

In Python:

side1 = float(input("Side 1: "))

side2 = float(input("Side 2: "))

side3 = float(input("Side 3: "))

if side1>0 and side2>0 and side3>0:

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

       if side1 == side2 == side3:

           print("Equilateral Triangle")

       elif side1 == side2 or side1 == side3 or side2 == side3:

           print("Isosceles Triangle")

       else:

           print("Scalene Triangle")

   else:

       print("Invalid Triangle")

else:

   print("Invalid Triangle")

Explanation:

The next three lines get the input of the sides of the triangle

<em>side1 = float(input("Side 1: ")) </em>

<em>side2 = float(input("Side 2: ")) </em>

<em>side3 = float(input("Side 3: ")) </em>

If all sides are positive

if side1>0 and side2>0 and side3>0:

Check if the sides are valid using the following condition

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

Check if the triangle is equilateral

<em>        if side1 == side2 == side3: </em>

<em>            print("Equilateral Triangle") </em>

Check if the triangle is isosceles

<em>        elif side1 == side2 or side1 == side3 or side2 == side3: </em>

<em>            print("Isosceles Triangle") </em>

Otherwise, it is scalene

<em>        else: </em>

<em>            print("Scalene Triangle") </em>

Print invalid, if the sides do not make a valid triangle

<em>    else: </em>

<em>        print("Invalid Triangle") </em>

Print invalid, if the any of the sides are negative

<em>else: </em>

<em>    print("Invalid Triangle")</em>

You might be interested in
ith reference to McCall's quality modle , what are the three important aspects of a software product ?
geniusboy [140]

Answer: According to McCall's quality model , the three important factors for the aspect of a software product are:-

  • Product Revision
  • Product Operation
  • Product Transition

Explanation:

Product Revision:-these are the factors which includes the maintenance, flexibility and testing of a software .

Product Operation:-these include the factors like checking the correctness, usability, reliability, efficiency and Integrity of software to maintain its quality

Product Transition:- these are the qualities that define the portability, interoperability and whether the software can be reused or not .

7 0
3 years ago
One of the most toxic components of a computer is the _____.
defon

I would say A. because that is true but mostly for older computers

4 0
4 years ago
What is an example of static we page?
OlgaM077 [116]
I’m pretty sure it’s B I hope this help you and I’m sorry if I got it wrong
4 0
4 years ago
There is one clear definition of IT. True False
Elenna [48]

Answer:

That is False. it has more definitions not only one.

8 0
3 years ago
Behave online in the same way as you wish to be treated true false​
Yuliya22 [10]

True; you have treat others the way you want to be treated. It is the golden rule for meeting anyone, whether it's online or in real life. If you were being mean to someone online, would you want someone to be mean to you the same way you were mean to that person? So, the answer is true.

5 0
3 years ago
Other questions:
  • - The __________ is called a single-selection statement.
    10·1 answer
  • What cell address indicates the intersection of the first row and the first column in a worksheet?
    15·2 answers
  • Keion works as a freelancer creating websites and designing logos for clients. He recently had a hard drive failure and lost wor
    10·1 answer
  • In a non-formatted/standard template, if the number 25 is converted to text format, the
    14·1 answer
  • Select the correct answer.
    5·1 answer
  • Name at least 3 different portable computer devices that can be purchased
    15·2 answers
  • I have crummy WiFi and a bad pc. If I get a gaming computer, will it improve my FPS or ping?
    14·2 answers
  • Question 2 (6 points)
    11·1 answer
  • How do i automate survey monkey results to my email
    11·1 answer
  • I am trying to do a python code quiz for school, the basic requirements for the quiz are: the quiz MUST have 10 questions
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!