FAQ
----------------------------------------
Date: Sun, 26 May 2013 10:52:14 -0700
Subject: Cutting a deck of cards
From: rvince99 at gmail.com
To: python-list at 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)


;)

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 18 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedMay 26, '13 at 5:52p
activeJun 2, '13 at 5:57a
posts18
users12
websitepython.org

People

Translate

site design / logo © 2021 Grokbase