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


Groups > comp.lang.python > #77390

Re: This could be an interesting error

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:error': 0.03; 'preferably': 0.05; 'logic': 0.09; 'missed': 0.12; '(x,': 0.16; 'cleaner': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'hint:': 0.16; 'item:': 0.16; 'index': 0.16; 'fix': 0.17; 'wrote:': 0.18; '>>>': 0.22; 'example': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'michael': 0.29; 'words': 0.29; 'code': 0.31; 'easier': 0.31; 'maybe': 0.34; 'something': 0.35; 'but': 0.35; 'add': 0.35; 'words,': 0.36; 'doing': 0.36; 'should': 0.36; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'washington,': 0.60; "you're": 0.61; 'real': 0.63; 'more': 0.64; 'subject:This': 0.74; 'subject:interesting': 0.84; 'vital.': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
Date Sun, 31 Aug 2014 22:52:13 -0600
From Michael Torrie <torriem@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
MIME-Version 1.0
To python-list@python.org
Subject Re: This could be an interesting error
References <pm270ap6g01k6a5ip10ij1lgtebsrv00mr@4ax.com> <mailman.13668.1409523047.18130.python-list@python.org> <2jc70at4qcpqmbes72r2f0tsjk8up0j6mn@4ax.com> <5403F2FE.1030403@gmail.com>
In-Reply-To <5403F2FE.1030403@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
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.13680.1409547142.18130.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409547142 news.xs4all.nl 2881 [2001:888:2000:d::a6]:59795
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77390

Show key headers only | View raw


On 08/31/2014 10:15 PM, Michael Torrie wrote:
> On 08/31/2014 06:04 PM, Seymore4Head wrote:
>>>    for x,letter in enumerate(word):
>>>        # x is index (position), letter is the value at that index
>>>        if letter in "AEIOUaeiou":
>> I tried changing:
>> for x in range(len(test)):
>> to
>> for x in enumerate(test):
> 
> Read my example again. You missed something vital.  enumerate returns
> both a position and the item:
> 

Sigh.  Oops.  Make that:

for x,letter in enumerate("hello"):
    print (x, " ", letter)

You definitely should start doing it this way.  It's more "pythonic" and
also cleaner and easier to understand when you're reading the code later.

Also you did add Y to your list of vowels, but what about words that
have no vowels and no Y?  Maybe not real words, but things that might be
likely to be in sentences:  "I am from Washington, DC"

It's way better to fix your logic so you have a fall-back.  Hint: Set
pigword before your enter the loop so that it always contains
_something_, preferably the original word!

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


Thread

This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 17:02 -0400
  Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 17:07 -0400
  Re: This could be an interesting error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-31 22:38 +0100
    Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 18:04 -0400
      Re: This could be an interesting error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-31 23:26 +0100
    Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 18:42 -0400
      Re: This could be an interesting error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-01 00:21 +0100
        Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 20:08 -0400
          Re: This could be an interesting error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-01 01:56 +0100
            Re: This could be an interesting error Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-01 12:53 +1000
              Re: This could be an interesting error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-09-01 07:34 +0100
          Re: This could be an interesting error Ned Batchelder <ned@nedbatchelder.com> - 2014-08-31 22:12 -0400
            Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 22:54 -0400
              Re: This could be an interesting error Larry Hudson <orgnut@yahoo.com> - 2014-08-31 21:55 -0700
                Re: This could be an interesting error Chris Angelico <rosuav@gmail.com> - 2014-09-01 15:12 +1000
                Re: This could be an interesting error Rustom Mody <rustompmody@gmail.com> - 2014-08-31 23:53 -0700
  Re: This could be an interesting error MRAB <python@mrabarnett.plus.com> - 2014-08-31 22:53 +0100
    Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 18:07 -0400
      Re: This could be an interesting error Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-01 12:12 +1000
        Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 22:13 -0400
        Re: This could be an interesting error Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-09-01 19:25 +1200
  Re: This could be an interesting error Michael Torrie <torriem@gmail.com> - 2014-08-31 16:10 -0600
    Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 18:31 -0400
    Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 20:04 -0400
      Re: This could be an interesting error MRAB <python@mrabarnett.plus.com> - 2014-09-01 01:23 +0100
        Re: This could be an interesting error Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-31 20:35 -0400
      Re: This could be an interesting error Michael Torrie <torriem@gmail.com> - 2014-08-31 22:15 -0600
      Re: This could be an interesting error Michael Torrie <torriem@gmail.com> - 2014-08-31 22:52 -0600

csiph-web