[Tutor] regarding an error in the programming

Alan Gauld alan.gauld at btinternet.com
Sun Nov 3 08:57:06 EST 2019


On 03/11/2019 10:00, 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. 
> 

>   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.


Without seeing the code we have no idea what expl is but the error
indicates it is a sequence of some sort (list? set? array? dict?).

And the cosine is obviously going to be a float. As the error says,
you can't multiply a sequence by a float. So you either need to
change expl into something that can be multiplied by a float,
or you need to iterate over the sequence multiplying each
item individually.


HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list