Create a deck of cards a card is a tuple containing a


For my python class

Using the techniques described in class today, create a deck of cards. A card is a tuple containing a number between 1 and 13 representing the cards value and a string contianing "clubs", "diamonds", "hearts", or "spades".

Thus the ace of spaces would look like (1, "spades") and the king of diamonds (13, "diamonds") A deck is a list of 13 cards.

Your program should create a deck of cards, shuffle it, and then put the first five cards in the deck into a 5 element list which represents a hand.

You should write a series of funcitions which return boolean values that can be used to analyze this hand. def is_pair(hand):

should return true if there are exactly 2 cards of the same value def is_2_pair(hand):

should return true if there is one set of 2 cards with a common value and a second set of 2 cards with a different common value def is_3_ofakind(hand)

returns true if there are exactly 3 cards with a comrmon value def is_full_house(hand):

returns true if there are 3 cards with a common value and the other cards share a different common value def is_flush(hand):

if the five cards all have the same suit def is_straight(hand): returns true if the value of the five cards form a sequence which increases by 1 in each case.

For instance (2,"hearts"). (3,"spades"), (4, "diamonds"), (5,"hearts"), (6,"clubs") Your program should create a deck, shuffle it, create a hand from the first five cards, then call each of the above functions and print out which of them return True.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Create a deck of cards a card is a tuple containing a
Reference No:- TGS02906192

Expected delivery within 24 Hours