python noob help

toyko chris8nguyen at hotmail.com
Mon Oct 6 03:08:58 EDT 2008


So yeah, I have this assignment for my computer science class,
http://pages.cpsc.ucalgary.ca/~boyd/231/as1.pdf so far this is what I have
wrote, any suggestions cause I am stuck!


xc, yc = input()
r = input()
x1, y1 = input()
x2, y2 = input()

a = (x2 - x1)**2 + (y2 - y1)**2
b = 2((x1 - xc)(x2 - x1) + (y1 - yc)(y2 - y1))
c = (x1 - xc)**2 + (y1 - yc)**2 - r**2

discrim = (b * b - 4 * a * c) ** 0.5
Q = (-b + discrim) / (2 * a)
Q = (-b - discrim) / (2 * a)

x = (1-Q) * x1 + Qx2
y = (1-Q) * y1 + Qx2

# CIRCLE
print "circle", xc, yc, r

# LINE
print "line", x1, y1, x2, y2

-- 
View this message in context: http://www.nabble.com/python-noob-help-tp19832962p19832962.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list