Get this error when trying to plot a function with respect for a range of x values
TypeError: unsupported operand type(s) for *: 'float' and 'range'
import numpy as np
import matplotlib.pyplot as plt
x = range(273, 1273)
print(list(x))
y = -0.7765 + (0.014350 * x) - (0.000012209 * (x ** 2)) + (3.8289e-09 * (x ** 3))
plt.plot(x, y, 'r')
plt.show()
np.arangeinstead of rangerangereturns a generator, which is consumed when you doprint(list(x)). That means you cannot use it again later inplt.plot(x,y,'r').