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


Groups > comp.lang.python > #91699

Re: lotto number generator

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:number': 0.07; '1.)': 0.09; 'python': 0.11; 'example:': 0.11; 'instead.': 0.15; '2.)': 0.16; ':-).': 0.16; 'combinations': 0.16; 'pairs': 0.16; 'screen,': 0.16; 'subject:generator': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; '(in': 0.18; 'am,': 0.23; '2015': 0.23; 'header :In-Reply-To:1': 0.24; 'mon,': 0.24; 'message-id:@mail.gmail.com': 0.28; 'looks': 0.29; 'bad.': 0.29; 'function:': 0.29; 'tutorial': 0.29; 'maybe': 0.31; 'print': 0.31; 'probably': 0.32; 'url:python': 0.33; 'problem': 0.33; 'combination': 0.33; 'though.': 0.33; 'file': 0.34; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'something': 0.35; "isn't": 0.35; 'but': 0.36; 'url:org': 0.36; 'possible': 0.36; 'url:library': 0.36; 'so,': 0.37; 'subject:: ': 0.37; 'url:docs': 0.39; 'to:addr:python.org': 0.39; 'some': 0.40; 'url:3': 0.60; 'your': 0.60; "you'll": 0.61; 'url:index': 0.64; 'url:4': 0.70; 'million': 0.73; 'to:name:python': 0.84; 'url:tutorial': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=F8f4hfUKbHAoBjVrH/iDCzKEWEWsNOOu9fbu35a1sU0=; b=vhPwEFrZpKcBj0C40QNiVFZCgUlX4Dijv0p6fN9tnrqv9vbADhZyCcTF5V5ms85SPg 0XyQ+wB51AJCKuQryRcXIQJTvgIA1DqSamJaczOBfFC6fHA/eA7kOwOEARxobefnU/oO D5BbZ3wQGgkBJjQIoR1vpTMil458di34IbFidcGsIalxv0WTzL52wLXHpwCiN++xEtPQ WJlF7dPQKmjLdJYFbOkr3QxemnGAqtqsNo9Hr/SIsMFmXonu219g7Cq/Ew8hpqbuc56s K+E5wCwcPYFuWpAEAV0TgHp4hQK3PS2G51YCVM331XVaCIbucGvU+7LlFZ3mepK6rRHA n2OA==
X-Received by 10.107.16.93 with SMTP id y90mr1718322ioi.69.1433179029506; Mon, 01 Jun 2015 10:17:09 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CALwzidk1Rg7oODLYvKC9JgLbbB8Kd3y-XWsUBv5s3qRvORV9Nw@mail.gmail.com>
References <mki0um$q97$1@l01news1.ot.hr> <CALwzidk1Rg7oODLYvKC9JgLbbB8Kd3y-XWsUBv5s3qRvORV9Nw@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Mon, 1 Jun 2015 11:16:29 -0600
Subject Re: lotto number generator
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Newsgroups comp.lang.python
Message-ID <mailman.7.1433179038.13271.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433179038 news.xs4all.nl 2864 [2001:888:2000:d::a6]:57566
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 4767
X-Received-Body-CRC 2173139524
Xref csiph.com comp.lang.python:91699

Show key headers only | View raw


On Mon, Jun 1, 2015 at 11:13 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Mon, Jun 1, 2015 at 10:23 AM, gm <notMyMail@mail.not> wrote:
>> Hi.
>> I am new to python so am still in learning phase.
>>
>> I was thinking to make one program that will print out all possible
>> combinations of 10 pairs. I think this is a good way for something "bigger"
>> :-).
>>
>> This is how this looks like:
>>
>> 1.) 1 2
>> 2.) 1 2
>> 3.) 1 2
>> 4.) 1 2
>> 5.) 1 2
>> 6.) 1 2
>> 7.) 1 2
>> 8.) 1 2
>> 9.) 1 2
>> 10.) 1 2
>>
>> So, i want to print out (in rows) each possible configuration but for all 10
>> pairs.
>>
>> example:
>> 1 1 1 2 2 2 2 1 1 1
>> 2 2 2 1 1 1 1 2 2 2
>> 1 1 2 2 1 1 2 2 1 1
>> etc.
>>
>> What would be the best way to make something like this ?
>> Maybe some tutorial ?
>
> The Python tutorial is a good place to start:
>
>     https://docs.python.org/3.4/tutorial/index.html
>
> For your particular problem you'll probably want to use the
> itertools.product function:
>
>     https://docs.python.org/3.4/library/itertools.html#itertools.product
>
> I wouldn't recommend printing out every possible combination to the
> screen, though. That's over a million rows! Start with fewer pairs (4
> is probably good), or write them to a file instead.

Er, actually it's just 1024, so that isn't so bad. You probably still
don't want all that in your terminal, though.

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


Thread

lotto number generator gm <notMyMail@mail.not> - 2015-06-01 18:23 +0200
  Re: lotto number generator Grant Edwards <invalid@invalid.invalid> - 2015-06-01 17:07 +0000
  Re: lotto number generator Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-01 11:13 -0600
  Re: lotto number generator Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-01 11:16 -0600

csiph-web