I tried my best to list the topics for the exam but I may have forgotten one or two. Your default assumption should be that if I covered it in class, it is fair game for the exam.
I will add practice problems as I find new interesting questions, so come back to this page every few days, more practice problems may have appeared.
A recap video is now available here.
__ init __ (self, rank, suit)
rank is an int in the range 1-13 indicating the ranks ace-king and suit is a single character "d " "c " "h " or "s" indicating the suit (diamonds, clubs, hearts, or spades). Initialize the corresponding variables in the object.getRank(self)
Returns the rank of the card.getSuit (self)
Returns the suit of the card.value(self)
Returns the Blackjack value of a card. Ace counts as 1, face cards count as 10.__ str __ (self)
Returns a string that names the card. For example, "Ace of Spades". You can use numbers for the number cards, but use the English name for the face cards. getShuffledDeck
that creates a randomly shuffled full deck of cards (no jokers). To do this, you may want to have a look at the shuffle
function in the random librarygetTwoHands
that uses the previous function to get a randomly shuffled deck of cards, gets two hands of 4 cards from that deck (use slices) and returns those two handsmain
that uses the previous function to get two random hands and, over four lines, prints the contents of each hand in English and prints the total Blackjack value or each hand.main
just before it starts printing.