<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi!<br><br>I am trying to do an exercise abt classes, but I find it really hard even after reading. I have tryed to start it at the bottom of this document. I hope someone can help me. I have to submit the question by sunday.  <br><br>Exercise 7.4. Make a class for straight lines.<br>Make a class Line whose constructor takes two points p1 and p2 (2-<br>tuples or 2-lists) as input. The line goes through these two points (see<br>function line in Chapter 3.1.7 for the relevant formula of the line). A<br>value(x) method computes a value on the line at the point x. Here is<br>a demo in an interactive session:<br><br>>>> from Line import Line<br>>>> line = Line((0,-1), (2,4))<br>>>> print line.value(0.5), line.value(0), line.value(1)<br>0.25 -1.0 1.5<br><br>My answer:<br><br>class Line:<br>    def __init__(self, p1, p2):<br>        self.p1 = p1<br>        self.p2 = p2<br>        <br>    def value(self, x):<br>    p1 = (y1 - y0)/float(x1 -x0)   # Formula referred to in chapter 3.1.7 in the book<br>        p2 = (y0 - a*x0)                   # return <value of the line at point x><br>        <br><br>def line (x0, y0, x1, y1):<br>    p1 = (x0 - x1)<br>    p2 = (y0 - y1)<br>    return p1, p2<br><br><br><br>Kindest Regards<br>A.F.<br><br><br><br>                                      </div></body>
</html>