Skip to content

Instantly share code, notes, and snippets.

@JosephTLyons
Last active September 12, 2021 01:34
Show Gist options
  • Select an option

  • Save JosephTLyons/5637f729f48fef4e0fff6bf58e7ddb2e to your computer and use it in GitHub Desktop.

Select an option

Save JosephTLyons/5637f729f48fef4e0fff6bf58e7ddb2e to your computer and use it in GitHub Desktop.
A quick script to display a shuffled deck of cards
import random
cards = []
for suit in ["♠️", "♦️", "♣️", "❤️"]:
for rank in ["A", *list(range(2, 11)), "J", "Q", "K"]:
cards.append((rank, suit))
random.shuffle(cards)
for rank, suit in cards:
rank_string_justified = str(rank).rjust(2, " ")
print(rank_string_justified, suit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment