Skip to content

Instantly share code, notes, and snippets.

@eddie-knight
Created September 24, 2020 00:16
Show Gist options
  • Save eddie-knight/4e4aaf1d5bc266aa0c1c15a1cc660699 to your computer and use it in GitHub Desktop.
Save eddie-knight/4e4aaf1d5bc266aa0c1c15a1cc660699 to your computer and use it in GitHub Desktop.
import random
class deck_builder():
suit = [
"A", "K", "Q", "J",
"10", "9", "8",
"7", "6", "5",
"4", "3", "2"
]
def __init__(self):
self.deck = []
self.build()
def build(self):
for name in ["H", "S", "D", "C"]:
for card in self.suit:
self.deck.append(name + card)
def list(self):
return self.deck
def shuffle(self):
random.shuffle(self.deck)
def draw(self):
return self.deck.pop(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment