I have one list and one value like below:
y = [5, 6, 7, 3, 8, 10, 5, 2, 8, 15]
y0 = 9
if i plot then i am getting below plot
For plotting i am using below code:
a = []
for i in range(len(y)):
a.append(y0)
x = []
for i in range(len(y)):
x.append(i)
l5 = list(zip(y, x))
print(l5)
l6 = list(zip(a, x))
print(l6)
plt.plot(x, y, '-')
plt.plot(x, a, '-')
plt.show()
From the plot i can see there are 3 intersections. How can i get the intersection point's index(x value from the x axis)? For example in the above plot something like (4.2, 5.3, 8.1).