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


Groups > comp.lang.python > #63771

Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@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; 'subject:Open': 0.05; 'nested': 0.07; 'subject:Question': 0.07; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'itertools': 0.16; 'notation': 0.16; 'subject: \n ': 0.16; 'subject:java': 0.16; 'subject:programming': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'import': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'subject:please': 0.30; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; '>>>>': 0.31; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'doing': 0.36; "didn't": 0.36; 'subject:?': 0.36; 'should': 0.36; 'little': 0.38; "couldn't": 0.39; 'how': 0.40; 'matter': 0.61; "you're": 0.61; 'more': 0.64; 'six': 0.68; 'repeat': 0.74; 'to:none': 0.92
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=JRlx3i+O1o9CJl+OBON5/R5LdSA+Jk2oZkL67NMCYlw=; b=wXzNkYsZlDOgzduP6pz8ilkfIzFs38Wly7jy+neTZRk1Yd9fAQeMseD85ETXDUI8Va N4LVIEsTVLAXBk/zp9XtPdt7RE3HtzzKQF1Lb+DlzXas8DcBHQqv7pnD1ueqlTcgeQDx EZdU59iiCM51IEwAnBudsah+rlb6Wb226qewJo4gipkdT1RM25Oj6pa+KgoIIPUctSuR zspOmhfV6LRTb9ee4GV7b/jA4yOaSTzlD3TdYdJQvlRBdZ0IsFERW6IvvG6DMD6nblLh XbygdYEVtMLIe43LeehFtvvAy96DERzexnrELD1bzQUaHk1rvSRI1CY/FJbsC+5Wwcuu Z/aw==
MIME-Version 1.0
X-Received by 10.66.129.133 with SMTP id nw5mr24010419pab.98.1389537868821; Sun, 12 Jan 2014 06:44:28 -0800 (PST)
In-Reply-To <lau998$lnh$1@dont-email.me>
References <18b67e59-39d1-41e2-8977-b1c449b132e7@googlegroups.com> <roy-24194C.10455311012014@news.panix.com> <cd84d9dfi4bvs8o2her0qt9ethppuvpj7o@4ax.com> <mailman.5357.1389506333.18130.python-list@python.org> <lau998$lnh$1@dont-email.me>
Date Mon, 13 Jan 2014 01:44:28 +1100
Subject Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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 <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.5367.1389537878.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1389537878 news.xs4all.nl 2936 [2001:888:2000:d::a6]:56161
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63771

Show key headers only | View raw


On Mon, Jan 13, 2014 at 1:36 AM, Rotwang <sg552@hotmail.co.uk> wrote:
> On 12/01/2014 05:58, Chris Angelico wrote:
>>
>> (BTW, is there no better notation than six nested for/range for doing
>> 6d6? I couldn't think of one off-hand, but it didn't really much
>> matter anyway.)
>
>
> If you're willing to do an import, then how about this:
>
>>>> from itertools import product
>>>> len([x for x in product(range(1, 7), repeat = 6) if sum(x) < 14])/6**6
> 0.03587962962962963

Should have known itertools would have something. That's a little more
complicated to try to explain, but it's a lot shorter.

ChrisA

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


Thread

Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? pintreo mardi <bigearl497@outlook.com> - 2014-01-11 00:07 -0800
  Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Chris Angelico <rosuav@gmail.com> - 2014-01-11 19:21 +1100
    Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? pintreo mardi <bigearl497@outlook.com> - 2014-01-11 02:10 -0800
      Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-11 10:51 +0000
  Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-11 10:47 +0000
  Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Roy Smith <roy@panix.com> - 2014-01-11 10:45 -0500
    Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Steve Hayes <hayesstw@telkomsa.net> - 2014-01-12 07:08 +0200
      Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Chris Angelico <rosuav@gmail.com> - 2014-01-12 16:58 +1100
        Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Rotwang <sg552@hotmail.co.uk> - 2014-01-12 14:36 +0000
          Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Chris Angelico <rosuav@gmail.com> - 2014-01-13 01:44 +1100
  Re:Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Dave Angel <davea@davea.name> - 2014-01-11 19:37 -0500
  Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? matej@ceplovi.cz (Matěj Cepl) - 2014-01-12 02:36 +0100
  Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Dan Stromberg <drsalists@gmail.com> - 2014-01-11 18:43 -0800
  Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Grant Edwards <invalid@invalid.invalid> - 2014-01-12 18:53 +0000

csiph-web