Hey, how's it going? I decided to pick up Python for the heck of it and have been having some trouble creating this Card Deck class. All this class is supposed to do is initialize a deck, and then draw a card at total random:
import random
class CardDeck():
suit = ["Spades","Clubs","Hearts","Diamonds"]
number = ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace"]
def DrawCard():
randomsuit = random.randrange(0,3)
randomnumber = random.randrange(0,12)
print ("You drew the " + number(randomnumber)+ " of " + suit(randomsuit) +"!")
CardDeck.DrawCard()
Each time I try this, the IDLE returns: "NameError: global name 'number' is not defined". Just for kicks, I tried putting the number and suit arrays in the DrawCard() function, and instead I get the error: "TypeError: 'list' object is not callable"
Any advice would be appreciated