# Equation of a straight line

#### taha

hello I would like to create a program which by giving the equation of a straight line allows us to draw it, then a program which could determine the point of intersection of two straight lines according to their equations

#### phillip1882

i'm not sure how to do the first part, python doesn't have a graph function as far as i know,
but the second part is solvable.
Python:
``````eq1 = input("the first equation ")
eq2 = input("the second equation ")
eq1 = eq1[3:]
eq2 = eq2[3:]
eqE = eq1+"="+eq2
print("the first step, "+eqE)
slope1 = ""
slope2 = ""
remain1 = ""
remain2 = ""
for i in range(0,len(eq1)):
if eq1[i] == "x":
slope1 = eq1[:i]
remain1 = eq1[i+1:]

for i in range(0,len(eq2)):
if eq2[i] == "x":
slope2 = eq2[:i]
remain2 = eq2[i+1:]
slopeE = str(float(slope1) -float(slope2))

print("the second step "+remain1+"=" +slopeE+"x " + remain2)

remainE = int(remain1) - int(remain2)
print( "the third step,",remainE, "=", slopeE, "x")
solve = remainE/float(slopeE)
print("x = ", solve)
input()``````

#### Attachments

• lineEQuse.png
10 KB · Views: 4