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


Groups > comp.lang.python > #40448

Re: Question on for loop

X-Received by 10.224.185.201 with SMTP id cp9mr18037831qab.6.1362407654196; Mon, 04 Mar 2013 06:34:14 -0800 (PST)
X-Received by 10.50.12.227 with SMTP id b3mr386302igc.13.1362407654113; Mon, 04 Mar 2013 06:34:14 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!dd2no6962007qab.0!news-out.google.com!q17ni7qal.0!nntp.google.com!dd2no6961997qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Mon, 4 Mar 2013 06:34:13 -0800 (PST)
In-Reply-To <d5f0feb6-533a-445b-a89a-8113c1668e9d@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=15.203.169.126; posting-account=1a8NwAoAAAB7s3B2HLVQDLqOtVhlP4u9
NNTP-Posting-Host 15.203.169.126
References <d5f0feb6-533a-445b-a89a-8113c1668e9d@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <7345f1f5-d958-4fef-ad50-81fb526b4f2f@googlegroups.com> (permalink)
Subject Re: Question on for loop
From Bryan Devaney <bryan.devaney@gmail.com>
Injection-Date Mon, 04 Mar 2013 14:34:14 +0000
Content-Type text/plain; charset=ISO-8859-1
Lines 14
Xref csiph.com comp.lang.python:40448

Show key headers only | View raw


>         if character not in lettersGuessed:
> 
>         return True
> 
> return False

assuming a function is being used to pass each letter of the letters guessed inside a loop itself that only continues checking if true is returned, then that could work.

It is however more work than is needed. 

If you made secretword a list,you could just 

set(secretword)&set(lettersguessed) 

and check the result is equal to secretword.

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


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