Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95804

Re: Hi am new to python

Path csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:python': 0.14; 'looping': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'storing': 0.16; 'wrote:': 0.16; 'language': 0.19; 'please?': 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; 'this.': 0.28; 'tutorial': 0.29; 'print': 0.30; 'anyone': 0.32; 'url:python': 0.33; 'list': 0.34; 'should': 0.36; 'url:org': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'easy': 0.60; 'url:3': 0.60; 'charset:windows-1252': 0.62; 'sum': 0.69; 'yourself': 0.73; 'received:12': 0.81; 'url:tutorial': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Emile van Sebille <emile@fenx.com>
Subject Re: Hi am new to python
Date Mon, 31 Aug 2015 16:36:45 -0700
References <2b0f07c4-cda8-4bf9-9ef3-b80cccec81a4@googlegroups.com>
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 <2b0f07c4-cda8-4bf9-9ef3-b80cccec81a4@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.24.1441064314.23514.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1441064314 news.xs4all.nl 23764 [2001:888:2000:d::a6]:56472
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3151
X-Received-Body-CRC 1598201185
Xref csiph.com comp.lang.python:95804

Show key headers only | View raw


On 8/31/2015 4:27 PM, Chubasco Diranga wrote:
> Can anyone please help me with the following please?
>
> My question is in a while loop; how do l sum all the numbers in the given list (list_a)?
>
> list_a = [8, 5, 2, 4]
> sum_a = 0 # for storing the sum of list_a
> i = 0 # for looping through the list_a# Use a while loop to sum all numbers in list_a# If you store the sums into sum_a
> print(sum_a) # should print 19

You should familiarize yourself with the language -- there's a really 
easy answer to this.

Review the tutorial at https://docs.python.org/3/tutorial/

Emile



Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Hi am new to python Chubasco Diranga <alpharulz@gmail.com> - 2015-08-31 16:27 -0700
  Re: Hi am new to python Ian Kelly <ian.g.kelly@gmail.com> - 2015-08-31 17:34 -0600
  Re: Hi am new to python Emile van Sebille <emile@fenx.com> - 2015-08-31 16:36 -0700
  Re: Hi am new to python Chris Angelico <rosuav@gmail.com> - 2015-09-01 10:01 +1000
  Re: Hi am new to python Ben Finney <ben+python@benfinney.id.au> - 2015-09-01 10:22 +1000

csiph-web