Ok, so I just started using Python last week and I have written 4 VERY simple, non-GUI programs. This is for my intro to game physics class and I happen to be stuck on the last project until my next class. What this project is SUPPOSED to do is ask for two linear equations and determine if the intersect. I have it set to respond if the lines are parallel or the same, but I'm having an issue figuring out the code needed to determine an intersection point. Again, I just started using Python and don't have much experience with any language, so please excuse me if my coding is sloppy.
Here is what I have. Sorry for the wall of text...
#linear intersection
#asks for the equation to two lines and determines if they intersect, if not returns an error.
import math
x1 = "x+"
y1 = "y="
x = "x"
y = "y"
print "Please enter the slope for line 1."
m1 = raw_input("")
print "Please enter the y-intercept for line 1."
yi = raw_input("")
print "Please enter the slope for line 2."
m2 = raw_input("")
print "Please enter the y-intercept for line 2."
yi2 = raw_input("")
#do the lines intersect?
if m1 == m2 and yi == yi2:
print "Error!!! Infinite solutions, lines are the same."
elif m1 == m2 and yi != yi2:
print "Error!!! Zero solutions, lines are parallel."
else:
m1 != m2
#calculate if the lines intersect
#attempt to make things easier
y2 = "=" + yi
y3 = "=" + yi2
#lines in standard form
line1 = m1 + x + "-" + y + y2
line2 = m2 + x + "-" + y + y3
print line1
print line2
#print line3
print "One point of intersection at ."
raw_input("Press enter to exit.")