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


Groups > comp.lang.python > #44793

Re: (Learner-here) Lists + Functions = headache

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!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.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject: + ': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; 'jan': 0.12; 'code?': 0.16; 'hint': 0.16; 'none.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'so.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'hey': 0.18; 'bit': 0.19; 'not,': 0.20; 'example': 0.22; 'header :User-Agent:1': 0.23; 'guys': 0.24; 'code:': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'subject:) ': 0.29; "i'm": 0.30; 'such.': 0.31; 'wright': 0.31; 'supposed': 0.32; 'run': 0.32; 'problem': 0.35; 'test': 0.35; 'doing': 0.36; 'should': 0.36; 'needed': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'most': 0.60; 'received:173': 0.61; 'finally': 0.65; 'here': 0.66; 'natural': 0.68; 'discovered': 0.83; 'received:fios.verizon.net': 0.84; 'subject:here': 0.84; 'subject:Lists': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Jan Reedy <tjreedy@udel.edu>
Subject Re: (Learner-here) Lists + Functions = headache
Date Sun, 05 May 2013 21:30:25 -0400
References <ed7e2a6d-ad84-49b1-afae-6d1516fc1130@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
In-Reply-To <ed7e2a6d-ad84-49b1-afae-6d1516fc1130@googlegroups.com>
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1314.1367803836.3114.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367803836 news.xs4all.nl 15888 [2001:888:2000:d::a6]:51400
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44793

Show key headers only | View raw


On 5/5/2013 8:59 PM, Bradley Wright wrote:
> Hey guys and gals doing this tutorial(codecademy) and needed a bit help from the experienced.
>
> I'm writing a function that takes a list(one they supply during runtime)
> here's what my function is supposed to do

Do they supply an example so you can test both your comprehension and 
code? I think most specs given in natural language need such.

> 1. for each instance of the string "fizz" make a count
> 2. Finally return that count

Did you create an example problem to test your code? If not, do so.
Did you run your function with example data? If not, do so.

> here's my code:
>
> def fizz_cout(x):
>      count = 0
>      for item in x:
>          while item == "fizz":
>              count += 1
>              return count

Here is  hint as to some of what needs to be improved: this function 
will return either 1 or None. You should have discovered that by testings.

--
Terry Jan Reedy

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


Thread

(Learner-here) Lists + Functions = headache Bradley Wright <bradley.wright.biz@gmail.com> - 2013-05-05 17:59 -0700
  Re: (Learner-here) Lists + Functions = headache alex23 <wuwei23@gmail.com> - 2013-05-05 18:21 -0700
    Re: (Learner-here) Lists + Functions = headache Bradley Wright <bradley.wright.biz@gmail.com> - 2013-05-05 18:24 -0700
      Re: (Learner-here) Lists + Functions = headache Bradley Wright <bradley.wright.biz@gmail.com> - 2013-05-05 18:30 -0700
        Re: (Learner-here) Lists + Functions = headache Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-06 10:25 +0100
  Re: (Learner-here) Lists + Functions = headache Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-06 01:31 +0000
    Re: (Learner-here) Lists + Functions = headache Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-06 01:48 +0000
  Re: (Learner-here) Lists + Functions = headache Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-05 21:30 -0400
  Re: (Learner-here) Lists + Functions = headache 88888 Dihedral <dihedral88888@googlemail.com> - 2013-05-05 22:39 -0700
    Re: (Learner-here) Lists + Functions = headache Chris Angelico <rosuav@gmail.com> - 2013-05-06 17:32 +1000

csiph-web