Hi! I need code a list "d" to plot the s x t graph. The list "d" must have six itens too but if user input a value greater "a" in the list this value must be 0 in according to the equation "d=x*0". This code is a simplified example. Can someone help me?
When I run the code it displays the following error message:
AttributeError: 'int' object has no attribute 'append'
import matplotlib.pyplot a=int(input("a=") b=int(input("b=") c=[0,1,2,3,4,5] d=[] x=0 while (x<=a): d=b*(a-x) x=x+50 else: d=x*0 d.append(x) matplotlib.pyplot.title("Average Speed") matplotlib.pyplot.plot(c,d) matplotlib.pyplot.xlabel("t [s]") matplotlib.pyplot.ylabel("s [mi]") matplotlib.pyplot.show()Note
When I run the code it displays the following error message:
AttributeError: 'int' object has no attribute 'append'