Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'binary': 0.05; 'assignment': 0.07; 'iterate': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:python': 0.14; 'result.': 0.15; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; '2015': 0.20; 'sep': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'question': 0.27; 'specify': 0.27; '-0500,': 0.29; 'operators': 0.29; 'normally': 0.30; 'achieving': 0.33; 'tue,': 0.34; 'list': 0.34; 'too': 0.36; 'should': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'list.': 0.37; "didn't": 0.39; 'along': 0.39; 'to:addr:python.org': 0.40; 'charset:windows-1252': 0.62; 'sum': 0.69; 'received:12': 0.81; 'denis': 0.84; 'homework': 0.84; 'precursor': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: Hi am new to python Date: Wed, 9 Sep 2015 16:16:40 -0700 References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: www.westernstatesglass.com User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441840642 news.xs4all.nl 23771 [2001:888:2000:d::a6]:37153 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96231 On 9/9/2015 3:35 PM, Denis McMahon wrote: > On Tue, 08 Sep 2015 17:44:26 -0500, Nassim Gannoun wrote: > >> My question is in a while loop; how do l sum all the numbers in the >> given list (list_a)? > > You don't normally use a while loop or a counter to iterate over a list. > Such a question should only be used as a precursor to discussing better > methods of achieving the required result. As I understand it, the OP was given the homework assignment to sum up a list of numbers using while. Too bad he didn't also specify using binary operators along with while. :) Emile