[Tutor] regarding an error in the programming

Mats Wichmann mats at wichmann.us
Sun Nov 3 08:54:21 EST 2019


On 11/3/19 3:00 AM, Garvit wrote:
> Sir/ma’am,
> I am a student and learning python as the programming language.
> During the execution of a program about ‘pie charts’ an error is occurring i.e.
> 
> “Traceback (most recent call last):
>    File "C:\Users\yashmita jain\Desktop\garvit\computer\programs for file\prog 11.py", line 19, in <module>
>      plt.pie(Book_price,Book_name,colors=Colours,shadow=True,startangle=140,autopct='%1.1f%%')
>    File "C:\Users\yashmita jain\Desktop\garvit\computer\lib\site-packages\matplotlib\pyplot.py", line 2783, in pie
>      data is not None else {}))
>    File "C:\Users\yashmita jain\Desktop\garvit\computer\lib\site-packages\matplotlib\__init__.py", line 1538, in inner
>      return func(ax, *map(sanitize_sequence, args), **kwargs)
>    File "C:\Users\yashmita jain\Desktop\garvit\computer\lib\site-packages\matplotlib\axes\_axes.py", line 2964, in pie
>      x += expl * math.cos(thetam)
> TypeError: can't multiply sequence by non-int of type 'float' “.
> 
> How can I correct it? Do response quickly.

By reading and understanding the error message.

The failing line was:

x += expl * math.cos(thetam)

The error was:

TypeError: can't multiply sequence by non-int of type 'float' “

That means expl is a sequence type (list, or tuple, or ...) because the 
cos function always returns a float.  "Don't do that".

Since you didn't see fit to include any code at all nobody listening 
here can say anything more.



More information about the Tutor mailing list