Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40518
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <bryan.devaney@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'correct.': 0.07; 'subject:Question': 0.07; 'scripts': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'slightly': 0.15; 'bryan': 0.16; 'intersection': 0.16; 'returned,': 0.16; 'utc,': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'obviously': 0.18; 'shell': 0.18; 'assuming': 0.22; 'cc:2**0': 0.23; 'work.': 0.23; 'monday,': 0.23; 'needed.': 0.23; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'checking': 0.27; 'set.': 0.27; 'character': 0.29; 'function': 0.30; 'could': 0.32; 'skip:s 30': 0.33; 'equal': 0.33; 'received:google.com': 0.34; 'false': 0.35; 'itself': 0.37; 'being': 0.37; 'subject:: ': 0.38; 'build': 0.39; 'think': 0.40; 'letters': 0.62; 'more': 0.63; 'day': 0.73; '2013': 0.84; 'guessed': 0.84; 'do:': 0.91; 'mean.': 0.91 |
| X-Received | by 10.49.86.40 with SMTP id m8mr2430256qez.30.1362481967386; Tue, 05 Mar 2013 03:12:47 -0800 (PST) |
| Newsgroups | comp.lang.python |
| Date | Tue, 5 Mar 2013 03:12:47 -0800 (PST) |
| In-Reply-To | <mailman.2848.1362415074.2939.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=15.203.169.126; posting-account=1a8NwAoAAAB7s3B2HLVQDLqOtVhlP4u9 |
| References | <d5f0feb6-533a-445b-a89a-8113c1668e9d@googlegroups.com> <7345f1f5-d958-4fef-ad50-81fb526b4f2f@googlegroups.com> <mailman.2848.1362415074.2939.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 15.203.169.126 |
| MIME-Version | 1.0 |
| Subject | Re: Question on for loop |
| From | Bryan Devaney <bryan.devaney@gmail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | Python <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> |
| Message-ID | <mailman.2877.1362481970.2939.python-list@python.org> (permalink) |
| Lines | 60 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362481970 news.xs4all.nl 6876 [2001:888:2000:d::a6]:51743 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40518 |
Show key headers only | View raw
On Monday, March 4, 2013 4:37:11 PM UTC, Ian wrote: > 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. You are correct. sorry for the misleading answer, was digging through old shell scripts all day yesterday and brain was obviously not not the better for it.
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