I created two classes, one for the Card which can print any of the 52 cards and another class to build the Deck, I iterated through the range card class to build the whole deck I tried print(), return, str() but it keeps returning the object of the string.
from random import shuffle
class Card:
def __init__(self, suit, value):
self.suit = ['Spade', 'Hearts', 'Diamonds', 'Clubs'][suit]
self.value = ['Ace','2','3','4','5','6','7','8','9','10','Jack','Queen','King'][value]
def reveal(self):
print('Card is ' + self.value + ' of ' + self.suit)
class Deck:
def __init__(self):
self.card = []
for s in range(4):
for v in range(13):
self.card.append(Card(s,v))
shuffle(self.card)
def reveal(self):
return self.card
def draw(self):
if self.card == []:
return 'No more cards'
else:
return self.card.pop()