import matplotlib.pyplot as plt
from math import *
def main():
file=open('functions.txt','r')
lst=file.read().split('\n')
functions=[]
limits=[]
for item in lst:
''' loop that run on list '''
if 'x' in item: # check if there is x in string so i can know it a math function
functions.append(item)
else:
# put the last line from the txt in limits
limits.append(item)
lim_ab = limits[0].split()
a,b = float(lim_ab[0]),float(lim_ab[1])
x_vals=[float(x/100) for x in range(int(a*100),int(b*100))]
# values of x run betwen a and , and dix by 100 so i can take ass much point
# i cant put between float cause there is no limts points
for item in range(len(functions)):
''' run in lenth of func lst and for math fuction have diffrent y but same x '''
y_vals=[eval(functions[item]) for x in x_vals]
plt.axis([a,b,-1.2,4.2])
plt.plot(x_vals, y_vals, color='red')
plt.xlabel("x values")
plt.ylabel("y values")
plt.show()
main()