On Tue, Mar 29, 2011 at 11:24 AM, Raymond Hettinger <pyt...@rcn.com> wrote: >>>> print('\n'.join('*'*(c//2000) for _,c in sorted(Counter(map(sum, >>>> product(range(6), repeat=8))).items()))) > > > > > > > > > * > *** > ***** > ******** > ************ > ****************** > ************************* > ******************************** > ***************************************** > ************************************************* > ******************************************************** > ************************************************************** > ****************************************************************** > ******************************************************************* > ****************************************************************** > ************************************************************** > ******************************************************** > ************************************************* > ***************************************** > ******************************** > ************************* > ****************** > ************ > ******** > ***** > *** > * > > > > Re-posting (forgot to attach the output). > Besides the interesting output, other > interesting virtues include very low > memory usage and that the inner-loop > pipeline runs entirely in C.
Another (related) 3.2 one liner: from math import erf, sqrt def normal_cdf(x, mu=0, sigma=1): return (1/2) * (1 + erf((x-mu)/(sigma*sqrt(2)))) approximates the cumulative distribution function of the normal distribution. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list