Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40442
| Return-Path | <kirotawa@gmail.com> |
|---|---|
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.015 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'python,': 0.02; 'character,': 0.07; 'false.': 0.07; 'subject:Question': 0.07; 'iterate': 0.09; 'cc:addr:python-list': 0.10; 'mon,': 0.16; 'string': 0.17; 'wrote:': 0.17; 'email addr:gmail.com>': 0.20; 'all,': 0.21; 'trying': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'linux': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'values': 0.26; 'thanks!': 0.26; 'am,': 0.27; 'checking': 0.27; 'ibm': 0.27; 'message-id:@mail.gmail.com': 0.27; 'piece': 0.29; 'sistemas': 0.29; 'url:mailman': 0.29; 'character': 0.29; 'included': 0.29; "i'm": 0.29; 'maybe': 0.29; 'code': 0.31; 'url:python': 0.32; 'url:listinfo': 0.32; "aren't": 0.33; 'like:': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'false': 0.35; 'returning': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'list.': 0.35; 'but': 0.36; 'url:org': 0.36; 'characters': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'some': 0.38; 'que': 0.38; 'url:mail': 0.40; 'below,': 0.60; 'first': 0.61; '8bit%:20': 0.62; '8bit%:31': 0.65; 'want,': 0.65; '8bit%:100': 0.70; '8bit%:98': 0.71; 'url:wordpress': 0.75; '2013': 0.84; 'skip:\xe6 20': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=FpIX5EonOTpIvub2J3LLvPaW3TnV0IWb0epLKMYkwro=; b=BQv9nATQEVfcm1Y7zFB/dWla5TLvi4xasGUOxKCXNnaFXMpMpygI5fuh8mjzmNfppd w7NBYSm3ri2cT9VrhvXZR4tA4fYBQgDLzqakcZC1W/XhxmGeMowjrvzYHg5GG65y8R64 Hf+4Log0Iy7ls089VqDoxhDyXDCYbrZctlNall8A5sW1YXw/9IPjJywfA0U9aFlBTOPi TtJuXyKAtxvNzHTakJt57mJk5HFAFerT2+owfU4T4RR64A2/TcSqsMJc0y6P4WvIIdtJ bVa2s7E+zkOecEa4OGttvWEgM4lai2io+BP3Z1JwrKF/kIlZe9QSrBVF/+z88pL4ej3I 5Pfw== |
| X-Received | by 10.49.59.105 with SMTP id y9mr34639687qeq.41.1362402000058; Mon, 04 Mar 2013 05:00:00 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <d5f0feb6-533a-445b-a89a-8113c1668e9d@googlegroups.com> |
| References | <d5f0feb6-533a-445b-a89a-8113c1668e9d@googlegroups.com> |
| From | leo kirotawa <kirotawa@gmail.com> |
| Date | Mon, 4 Mar 2013 09:59:40 -0300 |
| Subject | Re: Question on for loop |
| To | newtopython <roshen.sethna@gmail.com> |
| Content-Type | multipart/alternative; boundary=047d7b6dc43c4142bd04d718ef51 |
| Cc | python-list@python.org |
| 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.2834.1362402009.2939.python-list@python.org> (permalink) |
| Lines | 134 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362402009 news.xs4all.nl 6856 [2001:888:2000:d::a6]:57729 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:40442 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
In fact this code is already doing what you want, but if the second character, by example, is not in secrectWord it'll jump out of the for and return. If you want that interact through the all characters and maybe count how many them are in the secrectWord, just take of the return there or do some list comprehension like: [ r for r in secrecWord if r in lettersGuessed] . []'s On Mon, Mar 4, 2013 at 9:18 AM, newtopython <roshen.sethna@gmail.com> wrote: > Hi all, > > I'm super new to python, just fyi. > > In the piece of code below, secretWord is a string and lettersGuessed is a > list. I'm trying to find out if ALL the characters of secretWord are > included in lettersGuessed, even if there are additional values in the > lettersGuessed list that aren't in secretWord. > > What this code is doing is only checking the first character of secretWord > and then returning True or False. How do I get it to iterate through ALL of > the characters of secretWord? > > for character in secretWord: > if character not in lettersGuessed: > return True > return False > > Thanks! > > Ro > -- > http://mail.python.org/mailman/listinfo/python-list > -- Leônidas S. Barbosa (Kirotawa) Engenheiro de Software - IBM (LTC - Linux Technology Center) MsC Sistemas e Computação Bacharel em Ciências da Computação. blog nerd: corecode.wordpress.com/ <http://corecode.wordpress.com/>User linux : #480879 "Mais sábio é aquele que sabe que não sabe" (Sócrates) "smile and wave" - =D + o/ (Penguins of Madagascar) 日本語の学生です。 コンピュータサイエンスの学位.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question on for loop newtopython <roshen.sethna@gmail.com> - 2013-03-04 04:18 -0800
Re: Question on for loop leo kirotawa <kirotawa@gmail.com> - 2013-03-04 09:59 -0300
Re: Question on for loop Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-04 08:04 -0500
Re: Question on for loop Dave Angel <davea@davea.name> - 2013-03-04 08:36 -0500
Re: Question on for loop Bryan Devaney <bryan.devaney@gmail.com> - 2013-03-04 06:34 -0800
Re: Question on for loop Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-04 09:37 -0700
Re: Question on for loop Bryan Devaney <bryan.devaney@gmail.com> - 2013-03-05 03:12 -0800
Re: Question on for loop Bryan Devaney <bryan.devaney@gmail.com> - 2013-03-05 03:12 -0800
Re: Question on for loop Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-04 07:41 -0800
Re: Question on for loop Ricardo Aráoz <ricaraoz@gmail.com> - 2013-03-04 10:21 -0300
csiph-web