Hi I am really a totally beginner any help or advice is much appreciated I am trying to study the code below but when I execute the code I got nothing I tried what I can but it gives me lot of error.Kindly take a look and any advice thank you very much
import random
ranks = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
suits = ['Hearts', 'Clubs', 'Spades', 'Diamonds']
class Card:
def c1(self, rank, suit):
self.rank = rank
self.suit = suit
def value(self):
if self.rank in ['J', 'Q', 'K']:
return 10
elif self.rank == 'A':
return 1,11
else:
return int(self.rank)
def c2_(self):
return self.rank + '-' + self.suit
class Deck:
def d1(self):
self.cards = []
for rank in ranks:
for suit in suits:
c = Card(rank, suit)
self.cards.append(c)
def shuffle(self):
random.shuffle(self.cards)
def draw_card(self):
if not self.cards:
raise Exception("No more cards: empty deck!")
card = self.cards.pop()
return card
def d2(self):
cards = []
for c in self.cards:
cards.append(str(c))
return str(cards)
def test2(self):
deck = Deck()
print
print deck
deck.shuffle()
print
print deck
tryss= Deck()
tryss.d1()
tryss.draw_card()
tryss.dshuffle()
tryss.d2()
tryss.test2()