Here's the code:
x = float(input("x1 = "))
y = float(input("y1 = "))
print ("your first point is " + str(x) + ", " + str(y))
tx = float(input("x2 = "))
ty = float(input("y2 = "))
print ("your second point is " + str(tx) + ", " + str(ty))
rise = ty / y
run = tx / x
slope = rise / run
tf = str(input("is these the correct points? - " + str(x) + "," + str(y) + " - " + str(tx) + "," + str(ty) + ": "))
if tf == str("yes") or str("Yes") or str("Y") or str("y") or str("oui"):
rise = ty / y
run = tx / x
slope = rise / run
if x == tx:
print("vertical line - slope underfined")
elif y == ty:
print("horizontal line, slope = 0")
else:
print ("slope of line is " + str(slope))
if tf == str("no") or str("No") or str("NO") or str("n") or str("N") or str("non"):
print("understood, now restate points")
x = float(input("x1 = "))
y = float(input("y1 = "))
print ("your first point is " + str(x) + ", " + str(y))
tx = float(input("x2 = "))
ty = float(input("y2 = "))
print ("your second point is " + str(tx) + ", " + str(ty))
rise = ty / y
run = tx / x
slope = rise / run
if x == tx:
print("vertical line - slope underfined")
elif y == ty:
print("horizontal line, slope = 0")
else:
print ("slope of line is " + str(slope))
I expected it to end the program after entering "y"
or "yes"
, but it continues.