Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'from:addr:yahoo.co.uk': 0.04; 'newbie': 0.05; 'reason,': 0.07; 'suppose': 0.07; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'random': 0.14; 'array.': 0.16; 'cards.': 0.16; 'here).': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'import': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'url:moin': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'skip:- 40': 0.29; 'array': 0.29; 'direction': 0.30; 'url:mailman': 0.30; 'url:wiki': 0.31; 'anyone': 0.31; 'url:python': 0.33; 'date:': 0.34; "can't": 0.35; 'but': 0.35; 'really': 0.36; 'done': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'half': 0.37; 'wrong': 0.37; 'two': 0.37; 'email addr:python.org': 0.37; 'to:addr:python-list': 0.38; 'subject:': 0.39; 'moving': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'lower': 0.61; 'simple': 0.61; "you're": 0.61; 'email addr:gmail.com': 0.63; 'cards': 0.65; 'email name:python-list': 0.65; 'charset:windows-1252': 0.65; 'cut': 0.74; 'cards,': 0.84; 'subject:Cutting': 0.84; 'received:89': 0.85; 'carlos': 0.91; 'cutting': 0.91; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Cutting a deck of cards Date: Sun, 26 May 2013 23:17:56 +0100 References: <4d02f46f-8264-41bf-a254-d1c20469626e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-89-240-174-199.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: X-Antivirus: avast! (VPS 130526-0, 26/05/2013), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369606677 news.xs4all.nl 15927 [2001:888:2000:d::a6]:51027 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46131 On 26/05/2013 19:16, 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) > > ;) > Wrong if you're using Python 3 :( -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence