Skip to content

Instantly share code, notes, and snippets.

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

  • Save JosephTLyons/87142845b435f4800767d84d51bfefc8 to your computer and use it in GitHub Desktop.

Select an option

Save JosephTLyons/87142845b435f4800767d84d51bfefc8 to your computer and use it in GitHub Desktop.
A ridiculous, minimalist, code-golf approach to displaying a shuffled deck of cards
import random
c = [(r, s) for s in ["♠️", "♦️", "♣️", "❤️"] for r in ["A", *list(range(2, 11)), "J", "Q", "K"]]
random.shuffle(c)
print("\n".join([f"{str(r).rjust(2, ' ')} {s}" for r, s in c]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment