Jan-31-2019, 04:59 PM
hello everybody,
I am begginner in python. I wrote the code under and I don't understand why I have the error you can find under
I am begginner in python. I wrote the code under and I don't understand why I have the error you can find under
from random import * class CardGame (object): Color = ["heart", "diamond", "club", "spade"] Value = [2, 3, 4, 5, 6, 7, 8, 9, 10, "valet", "queen", "king", "ace"] def __init__(self): self.cards = [] for A in Value : for B in Color : self.cards.append((A, B)) def CardName (self, Card): return "{0} of {1}".format(Value[Card[0]], Color[Card[1]]) def ShuffleGame (self): return shuffle(self.cards) def TakeCard (self): return self.cards.pop()
Error:Traceback (most recent call last):
File "/Users/nic/Desktop/python/Card_Game_2.py", line 22, in <module>
Game = CardGame()
File "/Users/nic/Desktop/python/Card_Game_2.py", line 9, in __init__
for A in Value :
NameError: name 'Value' is not defined
Thanks for your help