Question: Python 3.6 Implement a class representing a playing card, and name it PlayingCard. These class methods are required: 1 _init_(self, rank, suit): This is your

Python 3.6Python 3.6 Implement a class representing a playing card, and name it

Implement a class representing a playing card, and name it PlayingCard. These class methods are required: 1 _init_(self, rank, suit): This is your class initialize. rank is an int value that ranges from 1-13 (Ace, 2, 3, .., King.) suit is a single character "d", "c", "h", "s" representing each suit a card could possibly have (Diamonds, Clubs, Hearts, or Spades) 2 get_rank(self): When called on an instance of your PlayingCard class, it will return the rank of that particular card as an integer from 1-13 (Ace, 2, 3, .., King.) 3 get_suit(self): When called on an instance of your PlayingCard class, it will return the suit of that particular card as single-character string of either "d", "c", "h", "s", where the letters represent Diamonds, Clubs, Hearts, or Spades, respectfully. 4 bj_value(self): When called on an instance of your PlayingCard class, it will return the Blackjack value of that particular card as an integer. 5 _repr_: This one allows any instance of your class to properly describe itself when you attempt to, say, print an object representing an instance of your class PlayingCard. sample output: First, define your PlayingCard class, but don't yet define main(). Tell IDLE to load your program. Once program is loaded, and you are at the " > > > " prompt, you can test your class, directly: > > > c = PlayingCard(1, "s") > > print(c) Ace of Spades > > > Try making a Queen of Clubs card: > > > c2 = PlayingCard(12, "c") > > > print(c2) Queen of Clubs > > c2.bj_value() 10 > > > c2.get_rank() 12 > > > c2.get_suit() 'c' > > > Let's see how your program is require to run. This is what your main() should do (printing the PlayingCard instance and it's Blackjack value): Testing card class How many cards would you like to see? 5 Two of Hearts counts 2 King of Hearts counts 10 Ten of Spades counts 10 Five of Hearts counts 5 Ace of Diamonds counts 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!