Unsupported operand type(s) for +: 'float' and 'tuple'

Francesc Segura frsegrev at gmail.com
Fri Jun 10 08:12:44 EDT 2011


On 10 jun, 13:38, Tim Chase <python.l... at tim.thechases.com> wrote:
> On 06/10/2011 05:30 AM, Francesc Segura wrote:
>
> > Hello all, I'm new to this and I'm having problems on summing two
> > values at python.
>
> > I get the following error:
>
> > Traceback (most recent call last):
> >    File "C:\edge-bc (2).py", line 168, in<module>
> >      if (costGG<= cost + T0):
> > TypeError: unsupported operand type(s) for +: 'float' and 'tuple'
>
> > I'm working with networkx and my program is this one:
> ...
> > T0 = initCost*0,1
>
> Here, you're setting T0 to the tuple "(initCost*0, 1)" == "(0,
> 1)".  I think you mean to use a period instead of a comma.
>
> You then try to add that to a float (cost), and Python doesn't
> like that.  I wouldn't either :)
>
> -tkc

Thanks a lot, I am a noob retard!



More information about the Python-list mailing list