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
(03.05 LC) Match the term with its description. (4 points) Column A 1. Acid : Acid 2. Alkaline : Alkaline 3. pH : pH 4. Ion : Io
Nady [450]

Answer:

Follows are the matching to this question:

Explanation:

Column  A            Column B

     1                           c

     2                          d

     3                          b

     4                          a

Description of the matching:

  • In 1(Acid) the correct choice is (c) because the acid (HCl) dissociates to both the H+ ion and the Cl- ion as a solution.  
  • In 2(Alkaline ) the correct choice is (d) because alkaline NaOH is a solution that differentiates between the ions ( OH-) and Na+.  
  • In 3(pH ) the correct choice is (b) because for an A compound of less than 7 is an acid and an alkaline pH compound of more than 7. For neutral compounds, a pH of 7 is applicable.
  • In 4(Ion) the correct choice is (a) because Na+ ion is loaded positive, and Cl-ion is loaded negatively.
8 0
2 years ago
What can a method do with a checked exception? Check the exception or ignore it. Return the exception to the sender or handle it
Serggg [28]

Answer:

Handle the exception in a catch block or throw the exception to the method that called this method.

Explanation:

The try and catch statements occur in pairs. The try statement allows the user to define a block of code to be tested for errors while it is being executed.

The catch statement allows the user to define a block of code to be executed, if an error occurs in the try block.

If an exception is checked by a method, the method either handles the exception in a catch block or throw the exception to the method calling it.

8 0
2 years ago
Read 2 more answers
When you purchase an item in a store, you may be charged __________.
Ilya [14]
A sales tax? what are the options?
8 0
3 years ago
Read 2 more answers
You can choose to use a window manager only, and not use a desktop manager.
egoroff_w [7]
This seems more of a statement then a question if theres more id like to help
6 0
3 years ago
Read 2 more answers
8.
Licemer1 [7]

Answer:

yes

Explanation:

the faster the processor the better the computer loads things and works faster, there's little to no latency depending on the wifi

3 0
2 years ago
Other questions:
  • Points!!!!!!!! pls help
    13·2 answers
  • SecOps focuses on integrating the need for the development team to provide iterative and rapid improvements to system functional
    11·1 answer
  • Over the last few years, security cameras and other devices have become more common. Some people argue that these measures viola
    14·2 answers
  • What is one purpose of an algorithm
    14·1 answer
  • Which of the following tools and techniques shows theimpacts of one decision over another as well as the probability andcost of
    15·1 answer
  • ____ are the in-house equivalent of Internet newsgroups. They use Web- or software-based discussion tools that are available acr
    13·1 answer
  • Write a program to output a big A like the one below
    12·1 answer
  • Which approach is ideal for ensuring that a Webpage is maintained and does not appear neglected to users?
    13·1 answer
  • Computers are able to think like human beings
    8·1 answer
  • Coding with Loops Worksheet
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!