answer.
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
LUCKY_DIMON
20 days ago
12

Write a Python3 program to check if 3 user entered points on the coordinate plane creates a triangle or not. Your program needs

to repeat until the user decides to quit, and needs to deal with invalid inputs.
Computers and Technology
1 answer:
Rzqust [1K]20 days ago
4 0

Answer:

tryagain = "Y"

while tryagain.upper() == "Y":

    x1 = int(input("x1: "))

    y1 = int(input("y1: "))

    x2 = int(input("x2: "))

    y2 = int(input("y2: "))

    x3 = int(input("x3: "))

    y3 = int(input("y3: "))

    area = abs(x1 *(y2 - y3) + x2 * (y1 - y3) + x3 * (y1 - y2))

    if area > 0:

         print("Inputs form a triangle")

    else:

         print("Inputs do not form a triangle")

    tryagain = input("Press Y/y to try again: ")

Explanation:

To check for this, we will simply compute the area of the triangle given that inputs are on a coordinate plane i.e. (x,y).

An area greater than 0 means it's a triangle

Conversely, if not, it's not a triangle.

This line starts the loop with variable tryagain set to Y

tryagain = "Y"

while tryagain.upper() == "Y":

Following lines retrieve the triangle's coordinates     x1 = int(input("x1: "))

    y1 = int(input("y1: "))

    x2 = int(input("x2: "))

    y2 = int(input("y2: "))

    x3 = int(input("x3: "))

    y3 = int(input("y3: "))

Now, this computes the area

    area = abs(x1 *(y2 - y3) + x2 * (y1 - y3) + x3 * (y1 - y2))

Finally, this checks the condition mentioned above.

    if area > 0:

         print("Inputs form a triangle") This message appears if the condition is true

    else:

         print("Inputs do not form a triangle") This is printed if the condition is not met

    tryagain = input("Press Y/y to try again: ") It prompts the user to input new values

You might be interested in
Suggest how the following requirements might be rewritten in a quantitative way. You may use any metrics you like to express the
Amiraneli [1052]
Have you received the answer yet, or should I send it?
3 0
18 days ago
Return 1 if ptr points to an element within the specified intArray, 0 otherwise.
Rzqust [1037]

Answer:

int withinArray(int * intArray, int size, int * ptr) {

      if(ptr == NULL) // if ptr is NULL return 0

            return 0;

      // if the size of intArr is zero

      if(size == 0)

          return 0; // not found

  else  

          {

            if(*(intArray+size-1) == *(ptr)) // check if (size-1)th element equals ptr

                   return 1; // return positive indication

            return withinArray(intArray, size-1,ptr); // call function recursively with size-1 elements

         }

}

Explanation:

This is the complete part of the program.

4 0
21 day ago
A company requires an Ethernet connection from the north end of its office building to the south end. The distance between conne
maria [1035]

Answer:

A business needs an Ethernet connection that spans from the northern part of their office to the southern part. The distance of this connection is 161 meters and should support speeds up to 10 Gbps in full duplex mode. Which cable types would be suitable for these specifications?

ANSWER: Multi-mode fiber optic cable should be used

Explanation:

MULTI-MODE FIBER OPTIC CABLE

For distances extending to 100 meters, Copper CATX cable is adequate. However, since the distance here is 161 meters, an Ethernet extension is necessary. Using fiber optic cable along with a media converter allows for the transition from copper Ethernet lines to fiber. Multi-mode fiber supports distances up to 550 meters for 10/100/1000 Ethernet links.

Typically, multi-mode fiber is used for short-distance communication like inside buildings or across campuses. It can achieve data rates of up to 100 Gbps, well above the requirements here. Furthermore, this option is cost-effective compared to single-mode fiber optic cables. Fiber optic technology is also advantageous due to its immunity to electromagnetic interference, voltage spikes, ground loops, and surges, making it a better choice for this application.

7 0
1 month ago
Sophie often makes grammatical errors in her document. Which feature of the Spelling and Grammar tool can she use to understand
ivann1987 [1066]

Given that Sophie frequently commits numerous spelling and grammar mistakes in her document, it would be beneficial for her to utilize a function provided by Microsoft Word that assists her in recognizing her errors, which is what (D) Explain accomplishes.

Explain would indicate to Sophie the portions of her sentences that are incorrect, the words that were mistyped, and offer suggestions for better phrasing to prevent fragmented sentences.

8 0
1 month ago
Read 2 more answers
Explain working principle of computer?​
maria [1035]

Answer:

The principle behind how computer systems operate involves a primary machine-based function that remains invisible to us, serving as a control center that changes the input data into output. This central element known as the central processing unit (CPU) illustrates that the operation of computers is quite intricate.

Explanation:

5 0
2 months ago
Other questions:
  • Why were the practitioners of alternative software development methods not satisfied with the traditional waterfall method?
    9·1 answer
  • Which of the following is true of how computers represent numbers?
    9·2 answers
  • Write a statement that reads a floating point value from standard input into temperature. Assume that temperature. has already b
    6·1 answer
  • A technician with a PC is using multiple applications while connected to the Internet. How is the PC able to keep track of the d
    8·2 answers
  • Modern operating systems decouple a process address space from the machine’s physical memory. List two advantages of this design
    15·1 answer
  • Users report that the network access is slow. After questioning the employees, the network administrator learned that one employ
    7·1 answer
  • Allan needs to ensure that an object is in a very precise location on a slide. He decides to use the Ruler option to achieve thi
    5·2 answers
  • Write a program that prompts the user to enter three cities and displays them in ascending order. Here is a sample run: Enter th
    8·1 answer
  • Which of the following is NOT true about data?
    8·2 answers
  • Write a function named firstLast2 that takes as input an array of integers and an integer that specifies how many entries are in
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!