Cards deck problem
Michael Naunton
mmn at news.bellatlantic.net
Thu Oct 26 23:48:25 EDT 2006
On 26 Oct 2006 02:27:16 -0700, Arun Nair <nairarunv at gmail.com> wrote:
It is clear your professor does not understand computer science. Switch
to a new university now.
As noted in the problem, a deck has 52 cards. cardsLeft(self) therefore
always returns 52.
This may seem pendantic, but CS is mostly about thinking about (and thus
naming) things clearly. Find someone who does.
-- Michael
> d> Create a new class deck that represents a pack of 52 cards. Which
> supports the following methods:
>
> _ _init_ _ (self) - Creates a deck of cards in standard order.
> shuffle(self) - Randomizes the order of the cards
> dealCard(self) - Returns a single card from the top of the deck, and
> removes the card from the deck.
> cardsLeft(self) - Returns the number of cards left in the deck.
> Test your class by having it deal out a sequence of 'n' cards where 'n'
> is a number input by the user. The program should either print out the
> cards, or display them in a window.
>
More information about the Python-list
mailing list