I'm just learning python (with a background in VBA).
Why isn't this dictionary loading? I'm trying to come up with a full deck of cards.
Here's my code:
class Deck:
def load_deck(self):
suite = ('Spades', 'Hearts', 'Diamonds', 'Clubs')
rank = (2, 3, 4, 5, 6, 7, 8, 9, 10, "Jack", "Queen", "King", "Ace")
full_deck={}
for s in suite:
for r in rank:
full_deck.setdefault(s,r)
return full_deck
raw_deck = Deck()
raw_deck1 = raw_deck.load_deck()
print raw_deck1
Here's my output:
{'Hearts': 2, 'Clubs': 2, 'Spades': 2, 'Diamonds': 2}