Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python 3, create a class called Deck that has methods for shuffling and drawing a card. I already have a class for the playing

In Python 3, create a class called Deck that has methods for shuffling and drawing a card. I already have a class for the playing card so I'll paste it below. I just need the other class to shuffle those cards and draw one.

#Playing card class class PlayingCard: def __init__(self, face, suit): #Creating a dictionary for the faces self.cardFaces = {'2':0, '3':1, '4':2, '5':3, '6':4, '7':5, '8':6, '9':7, '10':8, 'Jack':9, 'Queen':10, 'King':11, 'Ace':12 } #Creating a dictionary for the suits self.cardSuits = {'Spades':0, 'Clubs':1, 'Diamonds':2, 'Hearts':3} #Initializing them to the parameter self.face = self.cardFaces[face] self.suit = self.cardSuits[suit]

#Function to return the face def getFace(self): return self.face

#Function to return the suit def getSuit(self): return self.suit

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

Step: 3

blur-text-image

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions