Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.04; 'python': 0.08; 'tuple': 0.09; 'error:': 0.12; 'am,': 0.14; 'wrote:': 0.14; '-tkc': 0.16; 'comma.': 0.16; 'francesc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 0.16; 'float': 0.16; "subject:' ": 0.16; 'traceback': 0.16; '(most': 0.16; "wouldn't": 0.17; 'cc:addr :python-list': 0.17; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'last):': 0.23; "doesn't": 0.25; 'values': 0.25; "i'm": 0.27; 'instead': 0.29; 'all,': 0.30; 'cc:addr:python.org': 0.30; 'operand': 0.30; 'typeerror:': 0.30; 'file': 0.34; 'header:User-Agent:1': 0.35; 'skip:" 10': 0.35; 'here,': 0.35; 'setting': 0.36; 'problems': 0.36; 'two': 0.37; 'think': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'either': 0.39; 'add': 0.39; 'period': 0.64; '05:30': 0.84; 'summing': 0.84; 'type(s)': 0.91 Date: Fri, 10 Jun 2011 06:38:48 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Francesc Segura Subject: Re: Unsupported operand type(s) for +: 'float' and 'tuple' References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307705938 news.xs4all.nl 49180 [::ffff:82.94.164.166]:50342 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7375 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 > 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