---------------------------------------- > Date: Sun, 26 May 2013 01:41:58 +1000 > Subject: Re: help how to sort a list in order of 'n' in python without using > inbuilt functions?? > From: ros...@gmail.com > To: python-list@python.org > > On Sun, May 26, 2013 at 12:28 AM, Steven D'Aprano > <steve+comp.lang.pyt...@pearwood.info> wrote: >> On Sat, 25 May 2013 19:14:57 +1000, Chris Angelico wrote: >> >>> def random_number(): >>> return 7 >> >> I call shenanigans! That value isn't generated randomly, you just made it >> up! I rolled a die *hundreds* of times and not once did it come up seven! > > You've obviously never used a REAL set of dice. Now, I have here with > me a set used for maths drill (to be entirely accurate, what I have > here is the company's stock of them, so there are multiples of each of > these - anyone need to buy dice?) with everything except the classic 1 > through 6 that everyone knows: > > * Six sides, faces marked 7 through 12 > * Six sides, faces marked "+x-\xf7+" and a "wild" marker (yes, two of +) > * Ten sides, numbered 0 through 9 > * Eight sides, numbered 1 through 8 > * Twelve sides, as above > * Twenty sides, as above > > Now, tabletop roleplayers will recognize the latter four as the ones > notated as d10, d8, d12, and d20, but these are NOT for gameplay, they > are for serious educational purposes! Honest! > > Anyway, all of those can roll a 7... well, one of them has to roll a > \xf7, but close enough right? Plus, if you roll 2d6 (that is, two > regular six-sided dice and add them up), 7 is statistically the most > likely number to come up with. Therefore it IS random. > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list
def f(x): return x+1 or you can just go: f(roll_d6()) ;) -- http://mail.python.org/mailman/listinfo/python-list