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


Groups > comp.lang.python > #46015

RE: help how to sort a list in order of 'n' in python without using inbuilt functions??

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <carlosnepomuceno@outlook.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.028
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'example:': 0.03; "subject:' ": 0.07; 'subject:help': 0.08; 'subject:using': 0.09; 'python': 0.11; 'def': 0.12; 'random': 0.14; "'n'": 0.16; 'ah!': 0.16; 'better!!': 0.16; 'dice': 0.16; 'fits': 0.16; 'hmm.': 0.16; 'range.': 0.16; 'received:65.55.116.7': 0.16; 'sense:': 0.16; 'subject: \n ': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'to:name:python-list@python.org': 0.22; 'adds': 0.24; 'received:65.55.116': 0.24; 'sort': 0.25; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'skip:- 40': 0.29; 'leave': 0.29; 'am,': 0.29; 'subject:list': 0.30; 'url:mailman': 0.30; 'question:': 0.31; 'know.': 0.32; 'url:python': 0.33; 'date:': 0.34; 'common': 0.35; 'but': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'list': 0.37; 'email addr:python.org': 0.37; 'depends': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'number,': 0.60; 'times': 0.62; 'email addr:gmail.com': 0.63; 're:': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'email name:python-list': 0.65; '26,': 0.68; '(any': 0.84; 'all!': 0.84; 'conclude': 0.84; 'operation)': 0.84; 'random,': 0.84; '+1000': 0.91; 'carlos': 0.91; '2013': 0.98
X-TMN [P2dAc1yDBu7B9Y7RUiF72qzMwrZ/e3sP]
X-Originating-Email [carlosnepomuceno@outlook.com]
From Carlos Nepomuceno <carlosnepomuceno@outlook.com>
To "python-list@python.org" <python-list@python.org>
Subject RE: help how to sort a list in order of 'n' in python without using inbuilt functions??
Date Sat, 25 May 2013 20:34:02 +0300
Importance Normal
In-Reply-To <CAPTjJmoRfFCkS34aoro1JVD1U5sCw6X7Z5Rx_o4juuhBMHnkdw@mail.gmail.com>
References <e31fbc7c-1bc0-4f9a-9f1d-68f963a9ec39@googlegroups.com>, <78192328-b31b-49d9-9cd6-ec742c092a29@googlegroups.com>, <mailman.2109.1369459444.3114.python-list@python.org>, <39ac7437-857e-483f-998c-8162c1039933@googlegroups.com>, <51a052d1$0$6599$c3e8da3$5496439d@news.astraweb.com>, <74e33270-a79a-4878-a400-8a6cda6637b2@googlegroups.com>, <BLU176-W22ACF37B4898379CD64258D7940@phx.gbl>, <CAPTjJmrTma=7xx2q37Ak8XoEc8UziKVEL77YLxkVac0+yrfhqA@mail.gmail.com>, <BLU176-W1833A5275DD72D3BBC43F7D7940@phx.gbl>, <CAPTjJmofQJ03a47C=LsnZKYv-37=qpYU-Asd5bRd+NopH5JdCA@mail.gmail.com>, <BLU176-W34BB46913B9DB79761CAE0D7940@phx.gbl>, <CAPTjJmrNodc7S5eOCeQEZdvz+3r06o4XnSgFx1ht7Ne1qDYpmw@mail.gmail.com>, <BLU176-W31B6CDED0C7EBB19C87FFCD7940@phx.gbl>, <mailman.2127.1369473306.3114.python-list@python.org>, <51a0ca91$0$30002$c3e8da3$5496439d@news.astraweb.com>, <CAPTjJmpWeG3xRqKSXuH1+SwLTJhi-S=USU8cmXaQHFmgib=iyw@mail.gmail.com>, <BLU176-W420C2B916435EE6F327BF6D7940@phx.gbl>, <CAPTjJmoRfFCkS34aoro1JVD1U5sCw6X7Z5Rx_o4juuhBMHnkdw @mail.gmail.com>
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-OriginalArrivalTime 25 May 2013 17:34:03.0167 (UTC) FILETIME=[0C8572F0:01CE596E]
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2146.1369503245.3114.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369503245 news.xs4all.nl 15934 [2001:888:2000:d::a6]:57656
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46015

Show key headers only | View raw


----------------------------------------
> Date: Sun, 26 May 2013 03:23:44 +1000
> Subject: Re: help how to sort a list in order of 'n' in python without using inbuilt functions??
> From: rosuav@gmail.com
> To: python-list@python.org
>
> On Sun, May 26, 2013 at 3:17 AM, Carlos Nepomuceno
> <carlosnepomuceno@outlook.com> wrote:
>> def f(x):
>> return x+1
>>
>> or you can just go:
>>
>> f(roll_d6())
>
> Hmm. Interesting. So now we have a question: Does adding 1 to a random
> number make it less random? It adds determinism to the number; can a
> number be more deterministic while still no less random?
>
> Ah! I know. The answer comes from common sense:
>
> a = random() # a is definitely a random number
> a -= random() # a is no longer random, we subtracted all the randomness from it
>
> Of course, since number-number => number, a is still a number. And so
> we can conclude that adding 1 to a random dice roll does indeed leave
> all the randomness still in it. But wait! That means we can do
> better!!
>
> a = random() # a is a random number
> a *= 5 # a is clearly five times as random now!
>
> ChrisA
> --
> http://mail.python.org/mailman/listinfo/python-list

It depends if the result (any operation) is in the required range.

For example: "int(random.random()+1)" it's not random at all!

But "int(random.random()*1000)" my look random if it fits your needs.

;) 		 	   		  

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


Thread

help how to sort a list in order of 'n' in python without using inbuilt functions?? lokeshkoppaka@gmail.com - 2013-05-24 01:04 -0700
  Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-24 18:12 +1000
  Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Dave Angel <davea@davea.name> - 2013-05-24 08:33 -0400
  RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-24 16:06 +0300
  Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? lokeshkoppaka@gmail.com - 2013-05-24 22:15 -0700
    Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-25 15:24 +1000
      Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? lokeshkoppaka@gmail.com - 2013-05-24 22:39 -0700
        Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-25 15:43 +1000
        Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-25 05:57 +0000
          Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? lokeshkoppaka@gmail.com - 2013-05-24 23:05 -0700
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-25 16:12 +1000
            RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 10:53 +0300
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-25 18:28 +1000
            RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 11:43 +0300
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-25 18:47 +1000
            RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 11:54 +0300
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-25 19:01 +1000
            RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 12:10 +0300
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-25 19:14 +1000
              Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-25 14:28 +0000
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Fábio Santos <fabiosantosart@gmail.com> - 2013-05-25 15:46 +0100
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-25 16:03 +0100
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-26 01:41 +1000
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-26 03:09 +0000
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-26 14:02 +1000
                RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 20:12 +0300
                RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 20:17 +0300
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-26 03:23 +1000
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-26 03:38 +0000
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Dan Sommers <dan@tombstonezero.net> - 2013-05-26 04:06 +0000
                Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Chris Angelico <rosuav@gmail.com> - 2013-05-26 14:28 +1000
                RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 20:34 +0300
            RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 12:30 +0300
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-25 13:01 +0100
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Roy Smith <roy@panix.com> - 2013-05-25 10:03 -0400
              Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Dave Angel <davea@davea.name> - 2013-05-25 10:27 -0400
            Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-25 14:30 +0000
            RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 20:07 +0300
            RE: help how to sort a list in order of 'n' in python without using inbuilt functions?? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 20:45 +0300
    Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? rusi <rustompmody@gmail.com> - 2013-05-24 22:43 -0700
    Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Roy Smith <roy@panix.com> - 2013-05-25 09:29 -0400
      Re: help how to sort a list in order of 'n' in python without using inbuilt functions?? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-05-25 17:59 +0300

csiph-web