Skip to content

Commit

Permalink
Fix flake8 issues in acey ducey
Browse files Browse the repository at this point in the history
- came seemingly out of nowhere and broke my totally unrelated PR
  • Loading branch information
GKnirps committed Aug 28, 2023
1 parent be75ea1 commit fa4f688
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions 01_Acey_Ducey/python/acey_ducey.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import random


cards = {
2: "2",
3: "3",
Expand All @@ -22,18 +23,19 @@
14: "Ace",
}


def play_game() -> None:
cash = 100
while cash > 0:
print(f"You now have {cash} dollars\n")
print("Here are you next two cards")
round_cards = list(cards.keys()) # gather cards from dictionary
card_a = random.choice(round_cards) # choose a card
card_b = card_a # clone the first card, so we avoid the same number for the second card
while (card_a == card_b): # if the cards are the same, choose another card
round_cards = list(cards.keys()) # gather cards from dictionary
card_a = random.choice(round_cards) # choose a card
card_b = card_a # clone the first card, so we avoid the same number for the second card
while (card_a == card_b): # if the cards are the same, choose another card
card_b = random.choice(round_cards)
card_c = random.choice(round_cards) # choose last card
if card_a > card_b: # swap cards if card_a is greater than card_b
card_c = random.choice(round_cards) # choose last card
if card_a > card_b: # swap cards if card_a is greater than card_b
card_a, card_b = card_b, card_a
print(f" {cards[card_a]}")
print(f" {cards[card_b]}\n")
Expand Down

0 comments on commit fa4f688

Please sign in to comment.