Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40463
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.088 |
| X-Spam-Evidence | '*H*': 0.83; '*S*': 0.00; 'subject:Question': 0.07; 'slightly': 0.15; 'bryan': 0.16; 'intersection': 0.16; 'returned,': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'assuming': 0.22; 'work.': 0.23; 'needed.': 0.23; 'pass': 0.25; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'checking': 0.27; 'set.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'character': 0.29; 'function': 0.30; 'could': 0.32; 'skip:s 30': 0.33; 'to:addr:python-list': 0.33; 'equal': 0.33; 'received:google.com': 0.34; 'false': 0.35; 'received:209.85': 0.35; 'itself': 0.37; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'build': 0.39; 'think': 0.40; 'letters': 0.62; 'more': 0.63; '2013': 0.84; 'guessed': 0.84; 'to:name:python': 0.84; 'do:': 0.91; 'mean.': 0.91 |
| 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:content-type; bh=Cn9m6qKr2uqcZixF/3tKDvJwMDEbRPSjxQ8V22apm68=; b=KtYX6xqC5B7NFs2QTa9GjNHCkpbKDGrP5Lg/3/6mTaSYhlBBhPqoG7V9Iz1/OxM5db CGJPqgAk+4mR501VvLEPFK42OKo/SHMbVRUnCkUvXgJMMAw5y/R6mgOKGgvcBmQ4FaeR rwe1ZQ3Pge2ZFMQtI7vbUVLOybE0w6AEJpNSFkpDBCwMIxMxQfDmVzPuyNDTNDq0Rrxs MVmg/kSkVoC4cckI3zFG9fGcjbmcSwPkhhV5ax3ERCI4RjemLlLYOKJ63w53ggz0k27J Qzq7+OvC1SyEiEE6BQlgYTzWfOTqTbobKWFXSywV2/YnzUxAXnV7CpS/iDoU05t4Zv5y gtrg== |
| X-Received | by 10.220.156.8 with SMTP id u8mr7917741vcw.24.1362415071572; Mon, 04 Mar 2013 08:37:51 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <7345f1f5-d958-4fef-ad50-81fb526b4f2f@googlegroups.com> |
| References | <d5f0feb6-533a-445b-a89a-8113c1668e9d@googlegroups.com> <7345f1f5-d958-4fef-ad50-81fb526b4f2f@googlegroups.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 4 Mar 2013 09:37:11 -0700 |
| Subject | Re: Question on for loop |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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.2848.1362415074.2939.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362415074 news.xs4all.nl 6912 [2001:888:2000:d::a6]:33463 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40463 |
Show key headers only | View raw
On Mon, Mar 4, 2013 at 7:34 AM, Bryan Devaney <bryan.devaney@gmail.com> wrote: >> 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. Check the result is equal to set(secretword), I think you mean. set(secretword).issubset(set(lettersguessed)) might be slightly more efficient, since it would not need to build and return an intersection set. One might also just do: all(letter in lettersguessed for letter in secretword) Which will be efficient if lettersguessed is already a set.
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