Skip to content

Instantly share code, notes, and snippets.

@marklemay
Created May 31, 2022 14:50
Show Gist options
  • Save marklemay/1e50715a4dbdf18d180bbf3b2480cce2 to your computer and use it in GitHub Desktop.
Save marklemay/1e50715a4dbdf18d180bbf3b2480cce2 to your computer and use it in GitHub Desktop.
# https://en.wikipedia.org/wiki/Three-card_Monte
def shuffle(i, cards):
""" shuffles a list of cards for i iterations """
tmp = cards
cards[0] = cards[1]
cards[1] = cards[2]
cards[2] = tmp[0]
if i > 0:
shuffle(i - 1, cards)
def three_card_monte():
""" play a game of 3 card monte """
cards = ["queen of hearts", "jack of spades", "jack of clubs"]
shuffle(3, cards)
pick = int(input("where's the pretty lady (0,1,2)?"))
print(cards[pick])
three_card_monte()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment