Q. Why is following code not producing any result? Why is it giving errors?
(Note. All required libraries have been imported and are available)
CODE
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.
Answer :-
While sequence 'a' contains 4 elements,
Answer :-
sequence 'b' contains 6 elements.
Answer :-
For plotting, it is necessary that the two sequences being plotted must match in their shape.
Answer :-
The error message "ValueError: x and y must have same first dimension" usually occurs
Answer :-
when the two sequences passed to plt.plot() have different lengths.
Could people breathe the air on Mars?
Could people breathe the air on Mars?
Visit other story
Visit other story
Read more