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
Zielflug [23.3K]
2 years 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:
natulia [17]2 years 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 do this we simply calculate the area of the triangle given that inputs are on plane coordinates i.e. (x,y).

If the area is greater than 0, then it's a triangle

If otherwise, then it's not a triangle.

This line initializes iterating variable tryagain to Y

tryagain = "Y"

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

The following lines get the coordinates of the triangle

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

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

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

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

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

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

This calculates the area

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

This checks for the condition stated above.

    if area > 0:

         print("Inputs form a triangle") This is printed, if true

    else:

         print("Inputs do not form a triangle") This is printed, if otherwise

    tryagain = input("Press Y/y to try again: ") This prompts the user to try again with another set of inputs

You might be interested in
Write a Scientific report modeling a written reasearch paper on big data applications.​
Tom [10]

Answer:

hi im writing this to get points but i hope your doing good in school and pass you got this school is almost over good job bye

Explanation:

6 0
2 years ago
The Scientific Method is a/an
ser-zykov [4K]

Answer:

It's a method used in science to ask questions, research, observe, hypothesize, experiment, analyze data, and make conclusions.

Explanation:

5 0
2 years ago
Read 2 more answers
Which of the following devices is used to connect a computer to a network
CaHeK987 [17]
Most are wireless routers, meaning converged devices that include a WAP,router<span>, and often an </span>Ethernet switch<span> in the same device.</span>
3 0
2 years ago
These tools gather information from sources such as emails, text messages, and tweets and make the information instantly and pub
babunello [35]

Answer:

Crisis-Mapping

Explanation:

Social networks are characterized by the immediacy of the content that users produce, and that same feature can be transferred to the online mapping of crises and conflicts.

Characteristics Crisis-Mapping:

  • Real-time information processing.
  • Immediacy;
  • Visualization of the aggregated information can allow the detection of patterns that cause new analyzes to be undertaken or work hypothesis to verify.
  • Continuity in the tasks, the maps record activity without interruption during the twenty-four hours of the day and seven days per week.
  • Flexibility in the protocols, since the tasks are distributed and evolve according to the dynamics (the crisis maps evolve with the crisis itself).
8 0
3 years ago
What would 128 kbps look like on a phone? i.e. 4g, 3g, 2g, etc
vovangra [49]
5g I think.............
8 0
3 years ago
Other questions:
  • The Internet shopping cart is an example of which version of the web?
    15·1 answer
  • What is the cell membrane used for ​
    14·2 answers
  • If you wanted to have wireless connectivity in your home or​ apartment, you would need a​ _________________ to move packets of d
    11·1 answer
  • AP CSP - Write a program that takes 10 random numbers from 1 to 12 inclusively and averages them together.
    8·1 answer
  • When using the Internet, it is important to know the validity of web page you are using. How can you know if the information is
    5·1 answer
  • A recursive method may call other methods, including calling itself. A recursive method has:
    7·1 answer
  • (1) Prompt the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate varia
    13·1 answer
  • Which insert image option allows a user to compile, modify, and add captions to images?
    5·2 answers
  • Which are the top 10 Popular Cars and Video Games get max ammount of point that we can give​
    12·2 answers
  • Which terms would be found in search for "Mo*”? Check all that apply.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!