Cutting a deck of cards

Kamlesh Mutha mkamlesh at gmail.com
Sun May 26 14:05:51 EDT 2013


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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130526/8ffb524a/attachment.html>


More information about the Python-list mailing list