Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Marc Christiansen Newsgroups: comp.lang.python Subject: Re: Cutting a deck of cards Date: Sun, 26 May 2013 21:36:42 +0200 Lines: 39 Sender: Message-ID: References: <4d02f46f-8264-41bf-a254-d1c20469626e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de XBAnu1aMqgW8gfWaQvRWOwh3zIcZQrrwpeorUY1/iUqEGbMNw= X-Orig-Path: not-for-mail User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.8.13-gentoo (x86_64)) Xref: csiph.com comp.lang.python:46105 Carlos Nepomuceno wrote: > ---------------------------------------- >> Date: Sun, 26 May 2013 10:52:14 -0700 >> Subject: Cutting a deck of cards >> From: rvince99@gmail.com >> To: python-list@python.org >> >> Suppose I have a deck of cards, and I shuffle them >> >> import random >> cards = [] >> decks = 6 >> cards = list(range(13 * 4 * decks)) >> random.shuffle(cards) >> >> So now I have an array of cards. I would like to cut these cards at >> some random point (between 1 and 13 * 4 * decks - 1, moving the lower >> half of that to the top half of the cards array. >> >> For some reason, I can't see how this can be done (I know that it >> must be a simple line or two in Python, but I am really stuck here). >> Anyone have any direction they can give me on this? Thanks, RVic, >> python newbie >> >> -- >> http://mail.python.org/mailman/listinfo/python-list > > > list(range(13 * 4 * decks)) == range(13 * 4 * decks) > > ;) Not in Python3.x >>> decks = 6 >>> list(range(13 * 4 * decks)) == range(13 * 4 * decks) False AdiaĆ­ Marc