Last active
September 12, 2021 01:34
-
-
Save JosephTLyons/5637f729f48fef4e0fff6bf58e7ddb2e to your computer and use it in GitHub Desktop.
A quick script to display a shuffled deck of cards
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 characters
| 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