Apr-27-2017, 10:06 AM
So I've got an assignment that i need help with the game Blackjack on python.
I was given a list to work with (not allowed to change it either) and already have the functions for dealing the cards.
At the moment i am having trouble trying to convert the dealt cards (outputs as strings) into an number.
Here is my list for the deck of cards from a py file 'playing_bj':
Currently this is what i have:
So i am really just focusing on displaying the total from the dealt cards, along with its suites.
I feel that this is something very simple that i'm not seeing, i would really appreciate if anyone could guide me to the right direction and help me with how i can go about doing this.
I was given a list to work with (not allowed to change it either) and already have the functions for dealing the cards.
At the moment i am having trouble trying to convert the dealt cards (outputs as strings) into an number.
Here is my list for the deck of cards from a py file 'playing_bj':
List = ['AH','2H','3H','4H','5H','6H','7H','8H','9H','TH','JH','QH','KH', 'AD','2D','3D','4D','5D','6D','7D','8D','9D','TD','JD','QD','KD', 'AS','2S','3S','4S','5S','6S','7S','8S','9S','TS','JS','QS','KS', 'AC','2C','3C','4C','5C','6C','7C','8C','9C','TC','JC','QC','KC']
Currently this is what i have:
import playing_bj hand = [] # Deals starting card to player card = playing_bj.deal_one_card() #Adds dealt card to hand list hand.append(card) #Deal second card card = playing_bj.deal_one_card() #Adds second dealt card to hand list hand.append(card) #Display player's hand print (hand)At the moment the hand displays as [AH, 3S] but i'm required to display it in text format along with the total, eg: (Player Hand Total is 4/14 with Ace of Hearts and 3 of Spades)
So i am really just focusing on displaying the total from the dealt cards, along with its suites.
I feel that this is something very simple that i'm not seeing, i would really appreciate if anyone could guide me to the right direction and help me with how i can go about doing this.