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
2 months 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]2 months 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
Andre is finding working in an online group challenging because there are people in the group from many different cultural backg
Harlamova29_29 [1022]

Answer:

Varied Communication Styles

Diverse Attitudes Toward Conflict

Different Methods for Completing Tasks

Various Decision-Making Approaches

Different Perspectives on Disclosure

Diverse Ways of Knowing

Explanation:

6 0
3 months ago
Read 2 more answers
Which of the following is an object such as a field which can be inserted into a document
amid [951]

Response:

SORRY, but you need to ask a different question.

Reasoning:

since you didn't provide a complete question with options...

I can't assist with this one.

8 0
2 months ago
Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
ivann1987 [1066]

Answer:

129 \frac{2}{?} 23.4. \div 164 \times 5y1 +. \\.00487ggh

6 0
3 months ago
How can you check an orthographic drawing to be sure there are no missing lines
maria [1035]
Using a magnifying glass.
4 0
3 months ago
Other questions:
  • Explain how abstraction is used in a GPS system
    12·2 answers
  • Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in
    13·2 answers
  • What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
    12·1 answer
  • Which of the following type of online advertising intermediaries decide the placement and pricing of online display ads by using
    9·1 answer
  • Until 2015, each new Roblox user automatically had one friend. What was he called?
    12·2 answers
  • What problem does the DNS solve? How does the DNS help the world wide web scale so that billions of users can access billions of
    11·1 answer
  • Which correctly lists the two elements that make up the empty space in the universe? ice and debris debris and dark matter dark
    7·2 answers
  • Information systems cannot solve some business problems. Give three examples and explain why technology cannot help.
    11·1 answer
  • A data breach occurred in Cosmo Service, Inc. The incident results in huge losses of revenue as a result their mobile app servic
    8·1 answer
  • Write a statement that uses a conditional expression that determines if the credits variable is less than 0. If the condition is
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!