I'm learning python for a few weeks now on udemy.com and for my OOP classes, the mentor asked us to create a Blackjack game. My first task was to create a class for the deck. And I made this:
class Deck(object):
totalCards = 0
deck = [
["A", totalCards],
["2", totalCards],
["3", totalCards],
["4", totalCards],
["5", totalCards],
["6", totalCards],
["7", totalCards],
["8", totalCards],
["9", totalCards],
["10", totalCards],
["J", totalCards],
["Q", totalCards],
["K", totalCards],
]
def __init__(self, numberOfDecks):
self.numberOfDecks = numberOfDecks
Deck.totalCards = numberOfDecks * 4
def printDeck():
for i in Deck.deck:
print i
newDeck = Deck(6)
newDeck.printDeck()
The thing is... when I try to print the deck, I get and error that tells me that the method printDeck takes no argument and I'm passing one. I have no idea why.. Can anyone help me?
- Python 2.7.11
- I'm using Windows 10
- CMD
- Sublime Text 3