In Python Please Poker Hands There are many variants of the

In Python Please

Poker Hands There are many variants of the gambling card-game \"Poker\". The classic 5-card draw variant involves ranking a hand consisting of 5 cards from a 52-card deck of cards and then awarding the accumulated \"pot of money to the person with the highest ranking hand. Write a Python program that will simulate \"dealing\" 100,000 5-card hands and then report the frequency of occurrence of \"natural\" Poker hands. A \"natural hand\" is one that is dealt \"as-is\" without replacing any cards. You should first consult the following wikipedia page for a full description of the ranking of 5-card poker hands: http://en wikipedia.org/wiki/List-of-poker-hands Requirements You must do the following: 1. Construct an object class named Card that will represent individual playing cards from a standard 52- card deck (no Jokers or special cards). Each Card object will have two instance variables to represent the value and suit of the playing card. The values you choose are up to you. Include the following methods in the Card class: a. get value Return the value of the card b. gets Return the suit of the card Suit c. str 0 Return a string representing the card value and suit 2. Construct an object class named Carddeck that will simulate a deck of playing cards. The Carddeck class should include at least one instance variable: a list of 52 Card objects. 3. The Carddeck class must include the following methods: a. repr. Return a string with the deck displayed as a list b. shuffle Shuffle the deck (use .shuffle from the random module) c, dealcards (n) Return the \"next\" n Card objects from the deck in a list. Note that after the last card in the deck has been dealt, a new shuffled deck should be created automatically! If n is greater than the number of cards remaining in the deck, the new deck should not include the cards at the end that have just been dealt. 4. Construct a third object class named Pokerhand that will represent a 5-card poker hand of \"cards\" dealt from a Carddeck object. The Pokerhand class must include a single instance variable: a list containing 5 Cards. 5. The Pokerhand class must include the following methods: a. newHand (deck): get 5 new cards from the specified deck b. repr Return the hand-list as a string c. rank Return the rank of the poker hand as an integer value as follows 0: High card 1: One pair 2: Two pair 3 Three of a kind

Solution

hands.py

========================================================================

poker.py

=============================================================

cards.py

In Python Please Poker Hands There are many variants of the gambling card-game \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site