This code is giving me a SyntaxError. Not sure what is wrong.
import numpy as np
from matplotlib.pyplot as plt
x = np.linspace(0., 10, 0.1)
y = np.sin(x)
plt.plot(x, y);
plt.show();
This is the error message:
File "<ipython-input-4-b3d93c2fbfde>", line 2
from matplotlib.pyplot as plt
^
SyntaxError: invalid syntax
Your second line should be:
In addition, note that you don’t need a semi-colon terminator in Python.
Also, the
np.linspacecall that you use is wrong – it’ll just give you an empty array. Try the following instead: