Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102698
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Searching Sets (Lottery Results) |
| Date | Tue, 9 Feb 2016 11:04:56 +1100 |
| Lines | 25 |
| Message-ID | <mailman.115.1454976306.2317.python-list@python.org> (permalink) |
| References | <6afb7298-6da7-44f9-847e-9603554c2f09@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de l7FddBx4KLzR0Mv45G23dwu3evKhOii4eNRqFRB0aCxw== |
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'cc:addr:python-list': 0.09; '"if': 0.09; 'although,': 0.09; 'highlight': 0.09; 'iterate': 0.09; '2016': 0.16; 'balls': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'guidance.': 0.16; "isn't.": 0.16; 'marker': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'memory': 0.17; 'drawing': 0.18; 'load': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'seems': 0.23; 'feb': 0.23; 'ticket': 0.23; '(you': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'print': 0.30; 'code': 0.30; 'implement': 0.32; 'are:': 0.32; 'tue,': 0.34; 'handle': 0.34; 'received:google.com': 0.35; 'easiest': 0.35; 'set.': 0.35; 'asking': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'winning': 0.36; 'subject:: ': 0.37; 'display': 0.37; 'received:209': 0.38; 'where': 0.40; 'some': 0.40; 'your': 0.60; 'results': 0.66; 'chrisa': 0.84; 'drawings': 0.84; 'lottery': 0.84; 'subject:Sets': 0.84; 'to:none': 0.91; 'subject:Results': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Tw0VjQ5jlruDEtNIGPJOo/7G+eat72WEm9rLxu+rJAs=; b=DSBP68iTPvsFivKGIvte/42DLXO139uKWXzq5NTkHZNxZCW0DlW8svcnM8ZGtHL7Za DWBaQibEDtMZ4pdc8NeqdsIilud+8iNViVvqBDouSY9PLXcKu5tpvk2VYIHH5uwPcLnz kvw2K3WomM7dx9wy6muPbzJtBhDylK3J8kHhGhtzgZ2ashA+TRiVW57sY3YjnO3TtyVv ZZrDRZovfP3FEQpoRg1lVJen1lB9rn+HM2yKdjIsJqdxxyiZgMXbjQY9UbsTkWNllavo foq7vryS6UUMFmBIxTV3c6G1/PrhpN/IE8WqGLE1vgAeFxOs8IRM3EPcMd0KvTXOiEP5 +MXA== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=Tw0VjQ5jlruDEtNIGPJOo/7G+eat72WEm9rLxu+rJAs=; b=GMJFIOCiMWmXtA3v5UU2dRS2As3h2Wo3YYCVaVr7zmgBkaKvxdNwzU9jsxGjRDYdyf 6MCBbp8aVjm4D89BXgeaIoWr9udyoe6+mDlzhE66nKoaoW2f5X/bdheoNWj7Tm8e3Ywk A8hECYHaW9kgoQMbzN1Rk6BeeF3xPG86HuT0i33tGT1SV/sTF70ZWN3QcrXPRkAoqwCE xvIWHYVOABgCj/8GAsUF6P+iSuA2pNEMHKRma91eV2z/EpMw0m2RwtAvZWP2Oe35oH7J z+aMxfQh18O3MU/c4HSB6qgKziSjuwJglj5TLGUc2xlUqYR/l4zFh21gMu27ejavEHcK WyJg== |
| X-Gm-Message-State | AG10YOQRA5pqd4bEwMP54rnwuvlbDDEG+d3fHSiDoDR8DiA5okDg27DOlZvwLbAzvxAj6T2zw4AAJIRia7Mgtg== |
| X-Received | by 10.107.47.162 with SMTP id v34mr28123584iov.19.1454976296772; Mon, 08 Feb 2016 16:04:56 -0800 (PST) |
| In-Reply-To | <6afb7298-6da7-44f9-847e-9603554c2f09@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| 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> |
| Xref | csiph.com comp.lang.python:102698 |
Show key headers only | View raw
On Tue, Feb 9, 2016 at 8:45 AM, MrPink <tdsimpson@gmail.com> wrote: > I load the lottery drawings into memory for searching with the following code although, it is incomplete. I am stuck and need some guidance. > > The set datatype seems to be the best for searching, but how best can I implement it? > > And I want the results to highlight the numbers that were matched. For example, if the white balls in the drawing are: > "42 15 06 05 29" > > AND the numbers on the lottery ticket are: > "06 15 32 42 56" > > THEN the display might look like: > "06* 15* 32 42* 56" > > WHERE * signifies a match. > This suggests that there is an order to the numbers on your ticket (you want to print them out in the same order), but not to the winning numbers, which are simply a set. The easiest way to handle that would be to iterate over your numbers, asking "if number in winning_numbers:", and printing out a "match" marker if it is or a "non-match" marker if it isn't. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Searching Sets (Lottery Results) MrPink <tdsimpson@gmail.com> - 2016-02-08 13:45 -0800
Re: Searching Sets (Lottery Results) Chris Angelico <rosuav@gmail.com> - 2016-02-09 11:04 +1100
Re: Searching Sets (Lottery Results) MrPink <tdsimpson@gmail.com> - 2016-02-09 06:04 -0800
csiph-web