Create a deck of cards

Assignment Help Computer Engineering
Reference no: EM132112738

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.

Reference no: EM132112738

Questions Cloud

Create and use a function called compute compound interest : Your local bank wants you to write a program that would allow a bank customer to see what his/her savings account balance would be based on an initial balance.
Write a statement that toggles on_off_switch : Assume that x is a string variable has been given a value. Write an expression whose value is true if and only if x is a lower-case letter.
Write your first standalone python script : Your script will utilize the following string definition. testString = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" .
The element just before the element in plist whose index : Python:Assume that a variable named plist has been defined and is associated with a list that consists of 12 elements.
Create a deck of cards : 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".
Calculate a customers monthly water bill : The program should calculate and display the number of gallons of water used and the total charge for the water.
Parallel implementations - program for a pizza shop : Parallel Implementations - program for a pizza shop - creating the same application in the given programming languages
Write a statement that associates a new value : Write a statement that associates a new value with the first element of the list. The new value should be equal to twice the value of the last element.
Create a dictionary entry with the number : Write a program, dCount(lst,n), which will take a 2-dimensional list which consists of a number (lst[i][0]) and string (lst[i][1]).

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd