object-oriented programming return '{of {format(self valueself suitelsereturn '{of {format(names[self value- ]self suitnext we have class to represent group of cards its data consists of list of card objects it has number of methodsnextcard which removes the first card from the list and returns ithascard which returns true or false depending on if there are any cards left in the listsizewhich returns how many cards are in the listand shufflewhich shuffles the list import random class card_groupdef __init__(selfcards=[])self cards cards def nextcard(self)return self cards pop( def hascard(self)return len(self cards)> def size(self)return len(self cardsdef shuffle(self)random shuffle(self cardswe have one more class standard_deckwhich inherits from card_group the idea here is that card_group represents an arbitrary group of cardsand standard_deck represents specific group of cardsnamely the standard deck of cards used in most card games class standard_deck(card_group)def __init__(self)self cards [for in 'hearts ''diamonds ''clubs ''spades ']for in range( , )self cards append(card(vs)suppose we had just created single class that represented standard deck along with all the common operations like shuffling if we wanted to create new class for pinochle game or some other game that doesn' use the standard deckthen we would have to copy and paste the standard deck code and modify lots of things by doing things more generallylike we've done hereeach time we want new type of deckwe can build off of (inherit fromwhat is in card_group for instancea pinochle deck class would look like thisclass pinochle_deck(card_group)def __init__(self)self cards [for in 'hearts ''diamonds ''clubs ''spades ']*