Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

cards = sorted(sorted((str(n)+s for n in range(1,15) for s in ('D','C','H','S')),key = lambda x: int(x[:len(x)-1])),key = lambda x: x[-1]) I found out how to make

image text in transcribed

cards = sorted(sorted((str(n)+s for n in range(1,15) for s in ('D','C','H','S')),key = lambda x: int(x[:len(x)-1])),key = lambda x: x[-1])

I found out how to make the sorted deck of cards with the line above I believe. But I'm still not sure how to do this homework problem. We use PYTHON in this course.

Write a program to play a very modified version of the card game spades. The program will select two hands of 5 cards for a single player and the computer dealer. The hands should be chosen using a function and the random methods discussed on page 1. Your function should check the cards to be sure that they have not been used in the other hand. How you do that is up to you. There are many ways to keep track. If a card has been used, then another card will be chosen at random until a hand can be formed. After the second hand is dealt, all cards are available again. A winner of the game will be chosen based on the sum of all cards in the hand. 2. The sum of the cards will be calculated as follows: 2,3,.. 10 face value Jacks 11 Queens 12 Kings 13 Aces 14 The suit of the cards is used as a multiplier. Spades are worth 2 times the face value giving an advantage to any hands containing spades. All other suits are worth face value only

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions