Since I can't really focus on PROJECTS[since I don't know much python I can't do any projects because all my projects are BIG], So I decided to work on some problems I've gotten from school from started geometry, So I attempted to make a script to get the midpoint of a line segment using the formula giving:
<br><br>[1 and 2 are subscripts]<br><br>X1 + X2<br>----------- = mid pt. (x)<br>     2<br><br>Y1 + Y2<br>
----------- = mid pt. (y)<br>
     2<br><br>So i tried coding the following script.<br><br>#MIDPOINT OF A LINE<br>class midpoint:<br>    def __init__(self,x1,x2,y1,y2):<br>        self.x1 = x1<br>        self.x2 = x2<br>        self.y1 = y1<br>        
self.y2 = y2<br>        self.dictionary = {'x' : '','y' : ''}<br>        self.calculate_mid_point()<br>    def calculate_mid_point(self):<br>        X = self.x1 + self.x2<br>        X = X/2
<br>        self.dictionary['x'] = X<br>        Y = self.y1 + self.y2<br>        Y = Y/2<br>        self.dictionary['y'] = Y<br>c_x = -2<br>c_y = -2<br>d_x = 4<br>d_y = 3<br>midpoint_ = midpoint(c_x,d_x,c_y,d_y)
<br>print midpoint_.dictionary<br><br>It works and all, but I can't get the fraction or decimal from the output :S<br><br>Output:<br>{'y': 0, 'x': 1}<br><br>On my paper the real output is:<br>x = 1<br>
y = 1/2<br><br><br>