Q. Why is following code not producing any result? Why is it giving errors?


(Note. All required libraries have been imported and are available)

a = range (10, 50, 12)
b = range (90, 200, 20)
matplotlib.pyplot.plot(a, b)

Answer :-

The above code is producing error because the two sequences being plotted i.e., a and b do not match in shape. While sequence 'a' contains 4 elements, sequence 'b' contains 6 elements. For plotting, it is necessary that the two sequences being plotted must match in their shape.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post