1
resposta

Meu código está restornando que X e Y possuem dimensões diferentes (?)

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-84-75ad75d95ba0> in <module>()
      1 x = list(range(1, 9))
      2 y = notas_matematica
----> 3 plt.plot(x, y, marker='o')
      4 plt.title('Notas de matemática')
      5 plt.xlabel('Provas')

3 frames

/usr/local/lib/python3.6/dist-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
    340 
    341         if x.shape[0] != y.shape[0]:
--> 342             raise ValueError(f"x and y must have same first dimension, but "
    343                              f"have shapes {x.shape} and {y.shape}")
    344         if x.ndim > 2 or y.ndim > 2:

ValueError: x and y must have same first dimension, but have shapes (8,) and (0,)
1 resposta

Luiz, o que é notas_matematica? É uma lista? Se sim, quantos elementos estão na lista?

de acordo com o seu código x = [1,2,3,4,5,6,7,8] uma lista com 8 elementos y tem que ter o mesmo tamanho

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software