Question
Using the techniques described in class, create a deck of cards. Your program should create a deck of cards, shuffle it, and then put the
Using the techniques described in class, create a deck of 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_4_ofakind(hand): returns true if there are exactly 4 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started