Question

returns   a   list   containing   the   x-   and   y-coordinates   of   the   midpoint   of   the   line   segment&

returns   a   list   containing   the   x-   and   y-coordinates   of   the   midpoint   of   the   line   segment   determined   by   those   two   points,   using   decimal   division   (here   is   where   there   is   a   difference   between   versions   of   python).       Round   the   values   to   the   nearest   tenth.       Name   your   function   getMidpoint(x1,   y1,   x2,   y2).       For   example,      
   >>>getMidpoint(1,   3,   5.7   ,7)      
   should   return   the   midpoint   of   the   line   segment   whose   endpoints   are   (1,   3)   and                   (

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def getMidpoint(x1, y1, x2, y2):
    x = (((x1 + x2) * 10) // 2) / 10
    y = (((y1 + y2) * 10) // 2) / 10
    return [x, y]


print(getMidpoint(1, 3, 5.7, 7))

Add a comment
Know the answer?
Add Answer to:
returns   a   list   containing   the   x-   and   y-coordinates   of   the   midpoint   of   the   line   segment&
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • python program A line segment in one dimension is defined by an ordered pair of coordinates...

    python program A line segment in one dimension is defined by an ordered pair of coordinates representing the left and right boundaries of the segment. Write a class Segment that implements the interface below, which includes testing whether a point is in a segment, and whether two segments overlap. Note that the constructor should raise an appropriate exception if it receives invalid input (left end is on the right of the right end). • __init__(): constructor that takes one or...

  • The parametric equations below describe the line segment that joins the points P1(X1,Y1) and P2(x2,12). Consider...

    The parametric equations below describe the line segment that joins the points P1(X1,Y1) and P2(x2,12). Consider the triangle A(1, 1), B(4,2), C(1, 4). Find the parametrization, including endpoints and sketch to check. X = X1 + (x2 - X1) y = V1 + (Y2 - Y1)t Ostsi (a) A to B x(t) = 1 + (2-1) y(t) = 1+(3-1) ostsi (b) B to C x(t) = (t) = Ostsi (c) A to C X(t) = y(t) = Ostsi

  • The parametric equations where 0 tl describe the line segment that joins the points P1(x1, y and P2(x2, y2) Use a graphing device to draw the triangle with vertices A(1, 1), B(3, 4), C(1,7). Find the...

    The parametric equations where 0 tl describe the line segment that joins the points P1(x1, y and P2(x2, y2) Use a graphing device to draw the triangle with vertices A(1, 1), B(3, 4), C(1,7). Find the parametrization, including endpoints, and sketch to check. (Enter your answers as a comma- separated list of equations. Let x and y be in terms of t.) A to B B to C A to C The parametric equations where 0 tl describe the line...

  • MATLAB only please I am trying to get my getdatafuntion to work. I am also trying to get all my x...

    MATLAB only please I am trying to get my getdatafuntion to work. I am also trying to get all my x's, y's, and v's to popup in the command window so I can put in any value and it will find the value for me using the equation I put in. function project_9_sjl() % PROJECT_9_SJL project_9_sjl() is the driver function for the program. % %    Name: Scott Lawrence %   Date: 3/27/2019 %   Class: CMPSC 200 %   Description: Determine the optimal...

  • Python. Just work in the def sierpinski. No output needed. Will give thumbs up for any attempt beginning this code. Your task is to implement this algorithm in Python, returning a random collection of...

    Python. Just work in the def sierpinski. No output needed. Will give thumbs up for any attempt beginning this code. Your task is to implement this algorithm in Python, returning a random collection of inum-100, 000 points. You should then plot the points to see the structure. Please complete the following function: def sierpinski (po, v, f, inum) The four arguments are ·po the initial point. You may assume this is the origin, i.e., po = [0, 0] . v:...

  • The diagram doesnt allow me to paste it here. It is a diagonal line with F1...

    The diagram doesnt allow me to paste it here. It is a diagonal line with F1 pointing to the right and F2 pointing the opposite direction. F1=-F2. Two particles, 1 and 2, with masses m1 = 8×10-25 kg and m2 = 9×10-25 kg, are constrained to move in the x-y plane. They interact by a repulsive central force, F=k/r122, where r12 is the distance between the particles. The diagram shows the situation. The force on particle 2 is given by...

  • JAVA - Please follow ALL instructions, thank you!! Here is the API, for a Point class...

    JAVA - Please follow ALL instructions, thank you!! Here is the API, for a Point class representing a 2-dimensional point. https://docs.oracle.com/javase/7/docs/api/java/awt/Point.html Code an application class: 1.) (i.e., a class containing a main method), 2.) named PointApp that reads point data from the file points.text. This data is then used to create pairs of Point objects which are then used to flex (i.e, illustrate) the methods of the class. The format of the points.text file is: x1 y1 x2 y2 …...

  • Could anyone help add to my python code? I now need to calculate the mean and...

    Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...

  • Roadmap To start, use the provided template file (on Blackboard): project_01_template.py. Replace the pass statements with...

    Roadmap To start, use the provided template file (on Blackboard): project_01_template.py. Replace the pass statements with your code. Notice that we included test cases under every function. If you run the project_01_template.py file at this point it should print False for each test. After you write the correct code for each function, and then run the file, it should print True for each test. 1. Write a function named gc_content that takes one argument sed and performs the following tasks:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT