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

Jaydeep Patil patil.jay2009 at gmail.com
Fri Feb 21 01:31:53 EST 2014


HI,

I have a tuple. I need to make sqaure of elements of tuple and after that i want add all suared tuple elements for total. When i trying to do it, below error came.


Code:
seriesxlist1 = ((0.0,), (0.01,), (0.02,), (0.03,), (0.04,), (0.05,), (0.06,), (0.07,), (0.08,), (0.09,), (0.1,), (0.11,))

x2 = [x * x for x in seriesxlist1];

Error:
Traceback (most recent call last):
  File "<pyshell#188>", line 1, in <module>
    x2 = [x * x for x in seriesxlist1];
TypeError: can't multiply sequence by non-int of type 'tuple'



Please suggest me solution.





More information about the Python-list mailing list