Struggling with Python – How to return suite and card value?

By Ben Hill

I’ve been trying to do this Python assignemnt that I got but I have so far had no luck.

I have 2 files currently, one being playing which contains this:
mport random

# Deck of cards - first letter represents the face value and
# second letter represents the suit
deck = ['AH','2H','3H','4H','5H','6H','7H','8H','9H','TH','JH','QH','KH',
# Playing deck in use
playing_deck = []
# Function to determine whether there are any cards left in the
# deck of playing cards
# Parameters: No parameters
# Returns: True if the deck is empty, False otherwise
def is_empty_deck():
    # Check to see whether playing deck is empty
    return len(playing_deck) == 0
# Function to rebuild and shuffle the deck
# Parameters: No parameters
# Returns: Nothing is returned from the function.
def reset_deck():
    global playing_deck
    # Create new playing deck
    playing_deck = deck.copy()
    # Shuffle deck
# Function to deal one card
# Parameters: No parameters
# Returns: A string (containing two characters) representing
# the card delt, i.e. '2H' meaning 2 of Hearts
def deal_one_card():
    # Check to see whether there are any cards left
    if is_empty_deck():
        # Rebuild and shuffle deck
    # Return a card (string of two characters)
    return playing_deck.pop(0)

In my next file I have

import playing_cards
import random
player_hand = []
dealers_hand = []
#Players Cards
card = playing_cards.deal_one_card()
card = playing_cards.deal_one_card()
#Dealer Cards
card = playing_cards.deal_one_card()
card = playing_cards.deal_one_card()

This returns the values like this:
[‘5H’, ‘7D’] [‘4C’, ‘QD’]

How do I go about splitting these value up into their suite and card value ?
E.g.: 5 of Hearts and 7 of Diamonds?

Been trying for a couple of hours but with no luck, Any help would be greatly appreciated.

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273