Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63771
| 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 | 2014-01-13 01:44 +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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5367.1389537878.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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