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()
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.