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


Groups > comp.lang.python > #46090

Re: Cutting a deck of cards

References <4d02f46f-8264-41bf-a254-d1c20469626e@googlegroups.com>
Date 2013-05-26 23:35 +0530
Subject Re: Cutting a deck of cards
From Kamlesh Mutha <mkamlesh@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2184.1369591560.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

I guess, you will have to use list slicing mechanism to achieve the desired
result.

Hope this helps,

Cheers,
Kamlesh





On Sun, May 26, 2013 at 11:22 PM, RVic <rvince99@gmail.com> wrote:

> 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
>



-- 
Faith waiting in the heart of a seed promises a miracle of life which it
can not prove!
-Ravindranath Tagore

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


Thread

Cutting a deck of cards RVic <rvince99@gmail.com> - 2013-05-26 10:52 -0700
  Re: Cutting a deck of cards MRAB <python@mrabarnett.plus.com> - 2013-05-26 19:04 +0100
  Re: Cutting a deck of cards Kamlesh Mutha <mkamlesh@gmail.com> - 2013-05-26 23:35 +0530
  RE: Cutting a deck of cards Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-26 21:16 +0300
    Re: Cutting a deck of cards Marc Christiansen <usenetmail@solar-empire.de> - 2013-05-26 21:36 +0200
      RE: Cutting a deck of cards Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-26 22:54 +0300
        Re: Cutting a deck of cards Marc Christiansen <usenetmail@solar-empire.de> - 2013-05-26 22:13 +0200
      Re: Cutting a deck of cards Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-26 17:03 -0400
  Re: Cutting a deck of cards RVic <rvince99@gmail.com> - 2013-05-26 11:17 -0700
  Re: Cutting a deck of cards Roy Smith <roy@panix.com> - 2013-05-26 14:21 -0400
  Re: Cutting a deck of cards Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-26 23:17 +0100
  RE: Cutting a deck of cards Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-27 01:30 +0300
  Re: Cutting a deck of cards Chris Angelico <rosuav@gmail.com> - 2013-05-27 08:42 +1000
  RE: Cutting a deck of cards Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-27 01:51 +0300
  Re: Cutting a deck of cards Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-26 23:56 +0100
  Re: Cutting a deck of cards Lee Crocker <leedanielcrocker@gmail.com> - 2013-05-31 04:56 -0700
    Re: Cutting a deck of cards Modulok <modulok@gmail.com> - 2013-05-31 12:54 -0600
    Re: Cutting a deck of cards Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-01 18:16 +0100
      Re: Cutting a deck of cards Lee Crocker <leedanielcrocker@gmail.com> - 2013-06-01 22:57 -0700
  Re: Cutting a deck of cards Giorgos Tzampanakis <giorgos.tzampanakis@gmail.com> - 2013-06-01 14:58 +0000

csiph-web