Created
December 25, 2019 18:40
-
-
Save chrisjsimpson/a8c2b31c0818a46cc629541f6d105b8f to your computer and use it in GitHub Desktop.
Revisions
-
chrisjsimpson revised this gist
Dec 25, 2019 . No changes.There are no files selected for viewing
-
chrisjsimpson created this gist
Dec 25, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ from pprint import pprint import random #Order of importance suit = ['ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'jack', 'queen', 'king'] def build_pack(): ''' Builds and returns a pack of sorted cards''' cards = [] # Empty list of cards to be built # Build hearts for i,value in enumerate(suit, 1): cards.append({ 'suit': 'heart', 'number': i, 'color' : 'red' }) # Build diamonds for i,value in enumerate(suit, 1): cards.append({ 'suit': 'diamond', 'number': i, 'color' : 'red' }) # Build clubs for i,value in enumerate(suit, 1): cards.append({ 'suit': 'club', 'number': i, 'color' : 'black' }) # Build spades for i,value in enumerate(suit, 1): cards.append({ 'suit': 'spade', 'number': i, 'color' : 'black' }) return cards cards = build_pack()