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
Mariana [72]
3 years ago
11

(10 points) Make a user interface to get 3 points from the user which will be placed on the coordinate plane. Then write a Pytho

n3 function to check whether the points entered forms a right triangle. And another Python3 function to check whether the points entered forms a equilateral triangle. Call your functions for three user-entered points on the coordinate plane.
Computers and Technology
1 answer:
babymother [125]3 years ago
3 0

Answer:

def cord_input():

Global coordinates

coordinates = {'x1': 0, 'y1': 0, 'x2':0, 'y2':0, 'x3':0, 'y3':0}

for key, i in enumerate(coordinates.keys()):

if i < 2:

index = 1

coordinates [key] = float(input(f"Enter {key} coordinate for point {index}: "))

elif i >= 2 and i < 4:

index = 2

coordinates [key] = float(input(f"Enter {key} coordinate for point {index}: "))

else:

index = 3

coordinates [key] = float(input(f"Enter {key} coordinate for point {index}: "))

def sides(p1, p2, p3):

nonlocal a, b, c

a = ((p2[0] - p1[0])**2) + ((p2[1] - p1[1])**2)

b = ((p3[0] - p2[0])**2) + ((p3[1] - p2[1])**2)

c = ((p3[0] -p1[0])**2) + ((p3[1] - p2[1])**2)

def is_right_triangle(p1, p2, p3):

sides(p1, p2, p3)

if a+b == c or b+c == a or a+c == b:

print(f"Sides {a}, {b} and {c}")

return True

else:

return False

def is_equilateral(p1, p2, p3):

sides(p1, p2, p3)

if a==b and b==c:

print(f"Sides {a}, {b} and {c}")

return True

else:

return False

cord_input()

Explanation:

The python code above defines four functions, cord_input (to input a global dictionary of coordinates), sides ( to calculate and assign the sides of the triangle), is_right_triangle ( to check if the coordinates are for a right-angle triangle), and is_equilateral for equilateral triangle check.

You might be interested in
Write a function named enterNewPassword. This function takes no parameters. It prompts the user to enter a password until the en
Mkey [24]
______________———-___________
7 0
4 years ago
In what location along a river are you most likely to find a hydropower plant?
saul85 [17]

Answer:

I need help with that too I have that too

Explanation:

3 0
3 years ago
Wendy wants to learn how to write a computer program that can get the dimensions of a rectangle from the user and then tell the
otez555 [7]

Answer:

algorithms for finding the area

Explanation:

you need algorithms to find out any computer input information.

4 0
3 years ago
Read 2 more answers
What is the intermediate value of arr after two iterations of the outer for loop in the call sort(arr)
astra-53 [7]

The intermediate value of arr after two iterations of the outer for loop in the call sort(arr) is option C of the image attached.

<h3>What is intermediate value in programming?</h3>

This is known to be a variable that is often employed in assisting so that one can be able to compute what they want

Concluisvely, The intermediate value of arr after two iterations of the outer for loop in the call sort(arr) is option C of the image is because it will help you to have what you are after with the codes.

Learn more about ntermediate value from

brainly.com/question/11195842

#SPJ2

5 0
3 years ago
Read 2 more answers
Write a full class definition for a class named Averager, and containing the following members:______An data member named sum of
alina1380 [7]

Answer:

  1. public class Averager {
  2.    private int sum;
  3.    private int count;
  4.    public Averager(int sum, int count) {
  5.        this.sum = 0;
  6.        this.count = 0;
  7.    }
  8.    public int getSum(){
  9.        return sum;
  10.    }
  11.    public void add( int num){
  12.        this.sum+=num;
  13.        this.count++;
  14.    }
  15.    public int getCount(){
  16.        return this.count;
  17.    }
  18.    public double getAverage(){
  19.        double ave = (int)this.sum/this.count;
  20.        return  ave;
  21.    }
  22. }

Explanation:

  • Lines 1-3 contains the class declaration and the member (data fields)
  • Lines 4-7 is the constructor that initializes the fields to 0
  • Lines 8-10 is the method that returns the value of sum getSum()
  • lines 11-14 iss the method add() that adds a number to the member field sum and increases count by 1
  • lines 15 - 17 is the method that returns total count getCount()
  • Lines 18-21 is the method getAverage() That computes the average and returns a double representing the average values

6 0
4 years ago
Read 2 more answers
Other questions:
  • Most panoramic photography focuses on what subject?
    9·2 answers
  • A check of dorms revealed that 38% had refrigerators, 52% had TV’s and 21% had both a TV and a refrigerator. What’s the probabil
    14·1 answer
  • A group of computers that are interconnected order to share information or document is called a
    12·2 answers
  • Write a main method that prompts the user for an integer between 1 &amp; 20 (inclusive). If the user enters an invalid number, p
    8·1 answer
  • Memory management is concerned with __________.
    14·1 answer
  • The date your Science project is due should be recorded on a daily organizer. Please select the best answer from the choices pro
    14·2 answers
  • Please find one organization that has recently adopted virtualization and summarize their reasons for taking this approach. What
    12·1 answer
  • Grading on the curve is a method of grading that is based on the belief that letter grades for any given class should be distrib
    8·1 answer
  • RBTs are likely to be the ABA professionals who are implementing skills acquisition plans. In order to prepare and plan for a se
    14·1 answer
  • Source Code for TF2 - Please insert it here
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!