If I want to draw a y=x^2 graph from 0 to 9 in matlab, I can do
a = [0:1:10]
b = a.^2
plot(a,b)
Using python, I can do the same like below
import matplotlib.pyplot as plt
import numpy as np
a=[x for x in xrange(10)]
b=np.square(a)
plt.plot(a,b)
plt.show()
But to the contrary to my belief that python code is simpler, this takes more lines that matlab. (I guess python tries to make things light weight, so we need to import things when we actually need something, hence more lines..) Can I make above python code simpler(I mean shorter)?
EDIT : I know it doesn't matter and meaningless when it comes to processing time but I was just curious how short the code can become.
python) and ask if python can do something similar.