Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import shuffle
- faces = ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"]
- suits = ["s", "h", "d", "c"]
- deck = []
- for n,i in enumerate(faces):
- if i =="A":
- faces[n] = 14
- if i =="J" :
- faces[n] = 11
- if i =="Q":
- faces[n] = 12
- if i =="K" :
- faces[n] = 13
- for n,i in enumerate(suits):
- if i =="s":
- suits[n] = 21
- if i =="h" :
- suits[n] = 22
- if i =="d":
- suits[n] = 23
- if i =="c" :
- suits[n] = 24
- print (faces)
- print (suits)
- for t in range (0, len(faces)):
- for m in range (0, len(suits)):
- card = (faces[t], suits[m])
- deck.append(card)
- shuffle(deck)
- print (deck)
- deck.sort(key=lambda x: (x[0], x[1]))
- print (deck)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement