Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54254
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jugurtha.hadjar@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.027 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'expected.': 0.09; 'subject:How': 0.10; 'python': 0.11; 'def': 0.12; 'calculates': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'hey': 0.18; 'bit': 0.19; 'not,': 0.20; 'header:User-Agent:1': 0.23; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'list:': 0.30; 'gives': 0.31; 'program,': 0.31; 'easy,': 0.31; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'subject:?': 0.36; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'work?': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'new': 0.61; 'back': 0.62; 'william': 0.81 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=vQiPzFFMhyijSawPcvx+3ffqcJcH9+kghiAkggxWGac=; b=PqVAPwBGsJPihFYN3WkADO+3K2cc0pg9zNhQ0xCNT/jBlkjdbD2stqLme0EyTv6/qM 8XnxSNYf2NHTNSxcMkw2uS/melDTBMWlA/DvKTODcg3kWzbvFAyaZjlpP/g83XF+JDdM mP8dOEM3+RgdoBgcmkmAFrskNLgNgwOo1fKXozGEods7GdokPEkWlvR2zYLUBGef245Z JQiQw2twTI6jX8fd8pFxQ2UKmD+RiYnfib552PbHFStxCXt7aoEbbiGfRYOTuvP8NUAt eX/Pp4aPmjuhEpOVsqhNi7DHLWgnztc4cD7ouSoW64ixOBDp60hjRSXGP+DEBN0iASri ILlQ== |
| X-Received | by 10.14.9.72 with SMTP id 48mr8179303ees.42.1379375538510; Mon, 16 Sep 2013 16:52:18 -0700 (PDT) |
| Date | Tue, 17 Sep 2013 00:52:17 +0100 |
| From | Jugurtha Hadjar <jugurtha.hadjar@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: How do I calculate a mean with python? |
| References | <571f1251-17a5-44db-a859-17a6d8065151@googlegroups.com> |
| In-Reply-To | <571f1251-17a5-44db-a859-17a6d8065151@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.41.1379375545.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1379375545 news.xs4all.nl 15873 [2001:888:2000:d::a6]:36534 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54254 |
Show key headers only | View raw
On 09/17/2013 12:33 AM, William Bryant wrote: > Hey I am new to python so go easy, but I wanted to know how to make a program that calculates the maen. > > List = [15, 6, 6, 7, 8, 9, 40] > def mean(): > global themean, thesum > for i in List: > thecount = List.count(i) > thesum = sum(List) > themean = thesum / thecount > > Why doesn't this work? > Hello, William.. How about you try to execute one bit of your program, and if that works, try to add to it. Try list = [15, 6] list.count(1) And see if what it gives you back is what you expected. If not, why ? -- ~Jugurtha Hadjar,
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-16 16:33 -0700
Re: How do I calculate a mean with python? Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2013-09-17 00:52 +0100
Re: How do I calculate a mean with python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-16 23:55 +0000
Re: How do I calculate a mean with python? MRAB <python@mrabarnett.plus.com> - 2013-09-17 01:01 +0100
Re: How do I calculate a mean with python? Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2013-09-17 01:08 +0100
Re: How do I calculate a mean with python? Cameron Simpson <cs@zip.com.au> - 2013-09-17 09:59 +1000
Re: How do I calculate a mean with python? Dave Angel <davea@davea.name> - 2013-09-17 00:50 +0000
Re: How do I calculate a mean with python? Travis Griggs <travisgriggs@gmail.com> - 2013-09-17 08:25 -0700
Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 12:44 -0700
Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 12:45 -0700
Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 13:10 -0700
Re: How do I calculate a mean with python? Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-17 17:02 -0400
Re: How do I calculate a mean with python? MRAB <python@mrabarnett.plus.com> - 2013-09-17 22:26 +0100
Re: How do I calculate a mean with python? William Bryant <gogobebe2@gmail.com> - 2013-09-17 14:31 -0700
Re: How do I calculate a mean with python? Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-17 19:49 -0400
Re: How do I calculate a mean with python? Bryan Britten <britten.bryan@gmail.com> - 2013-09-17 18:53 -0700
csiph-web