Given two points in the plane (?,?) and (?,?), the slope of the line through them is the number ? given by ?=?−? ?−? i.e. the difference in the y-coordinates divided by the difference in the...


Given two points in the plane (?,?) and (?,?), the slope of the line through them is the number ? given by
?=?−? ?−?
i.e. the difference in the y-coordinates divided by the difference in the x-coordinates, or rise/run. Recall the Point class defined in the series of examples found here. Below is a stripped down version of this class, with only the initializer (given), and two new class functions called slope(?,?) and colinear(?, ?, ?). The first returns the slope of the line through the points ? and ?. The second returns True if and only if the three points ?, ? and ? lie on a line.


Given two points in the plane (a, b) and (c, d), the slope of the line through them is the<br>number m given by<br>b – d<br>m =<br>а — с<br>i.e. the difference in the y-coordinates divided by the difference in the x-coordinates, or rise/run. Recall<br>the Point class defined in the series of examples found here. Below is a stripped down version of this<br>class, with only the initializer (given), and two new class functions called slope(P, Q) and<br>colinear(P, Q, R). The first returns the slope of the line through the points P and Q. The second returns<br>True if and only if the three points P, Q and R lie on a line. Three such points are said to be colinear.<br>A well known theorem in plane geometry states that P, Q and R are colinear if and only if the slope<br>determined by P and Q equals the slope determined by Q and R. Complete the definitions of slope()<br>and colinear() below. (Note that these are class functions so they have no self parameter, and are<br>called as Point.slope() and Point.colinear(), respectively.)<br>class Point:<br>

Extracted text: Given two points in the plane (a, b) and (c, d), the slope of the line through them is the number m given by b – d m = а — с i.e. the difference in the y-coordinates divided by the difference in the x-coordinates, or rise/run. Recall the Point class defined in the series of examples found here. Below is a stripped down version of this class, with only the initializer (given), and two new class functions called slope(P, Q) and colinear(P, Q, R). The first returns the slope of the line through the points P and Q. The second returns True if and only if the three points P, Q and R lie on a line. Three such points are said to be colinear. A well known theorem in plane geometry states that P, Q and R are colinear if and only if the slope determined by P and Q equals the slope determined by Q and R. Complete the definitions of slope() and colinear() below. (Note that these are class functions so they have no self parameter, and are called as Point.slope() and Point.colinear(), respectively.) class Point: """Class representing a point in the x-y plane.""" def init (self, x, y): """Initialize a Point object.""" self.xcoord = x self.ycoord y #end init () def slope (P, Q): """Return the slope of the line through P and Q.""" # end slope () def colinear(P, Q, R): """Return true if and only if Points P, Q and R lie on a line.""" # end colinear # end Point class
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here