0

Look, I'm a newbie here, and I have no idea what I'm doing. I'm trying to write a program that finds where the line of a graph hits a certain point on the Y-axis, and it's just not working. I have no idea why. I've troubleshooted for a while but I am having a hard time fixing this bug. I plan on elaborating on this and making it better once I have the basics down, but well, I don't. so...

numfind = int(input("Where do you want to find where the graph hits?"))
go = True
start = int(input("Where do you want to start analyzing?"))
x = start
end = int(input("Where do you want to end analyzing?"))
y1 = " "
y2 = " "
num = " "
equation = x - 10
equation2 = (x + 1) - 10

while go and x < end:
    y1 = equation
    y2 = equation2
    if y1 < numfind and y2 > numfind:
        print("The point where f(x) = " + numfind + " is between " + y1 + " and " + y2)
        go = False
    elif y1 > numfind and y2 < numfind:
        print("The point where f(x) = " + numfind + " is between " + y2 + " and " + y1)
        go = False
    elif y2 == 0:
        print("The point where f(x) = " + numfind + " is " + y1)
    else:
        x += 1
       

I wanted to use two variables (y1 and y2) that would ladder through a certain range, checking to see if a y-value is between them. However, for some reason, it never finds the point. this confuses me.

Déjà vu
  • 28,223
  • 6
  • 72
  • 100

0 Answers0