import random deck = [] for suit in ('club', 'diamond', 'heart', 'spade'): for rank in range(1, 14): deck.append({'suit': suit, 'rank': rank}) def take_card(hand): hand.append(deck.pop(random.randrange(len(deck)))) player_hand = [] take_card(player_hand) take_card(player_hand) dealer_hand = [] take_card(dealer_hand) take_card(dealer_hand) def on_key_down(key): if key == keys.H: take_card(player_hand) def draw(): screen.fill((0, 0, 0)) output = [] output.append('Player hand:') for card in player_hand: output.append('suit: ' + card['suit'] + ', rank: ' + str(card['rank'])) output.append('') output.append('Dealer hand:') for card in dealer_hand: output.append('suit: ' + card['suit'] + ', rank: ' + str(card['rank'])) screen.draw.text('\n'.join(output), (15, 15))