commentscreenshotsource code.
- Attachment 1
- Attachment 2
- Attachment 3
- Attachment 4
For this part you can choose to write a playable game of Black jack for extra credit . In Blackjack the players is dealt a series of cards that have an associated point value . The goal isto collect a hand of cards that comes as close to 21 points as possible without going over 21 .In a Blackjack deck of cards every card has an associated value . All of the possible cards and the corresponding values can be found in the following lists . Note that the card atposition 0 ( 10 of hearts ) has it's point value at position O in the second list :"cards = ['10 of Hearts ' , ' 9 of Hearts ' , ' 8 of Hearts ' , '7 of Hearts ' , '6 of Hearts ' , '5 of Hearts ' , ' 4 Of Hearts ' , '3 of Hearts ' , ' 2 of Hearts "' Ace of Hearts ' , ' King of Hearts ' , ' Queen of Hearts ' ,`" Jack of Hearts ' , ' 10 of Diamonds ' , ' 9 of Diamonds ' , ' 8 of Diamonds ' , ' 7 of Diamonds '6 of Diamonds ' , '5 of Diamonds ' , ' 4 of Diamonds " ,13 of Diamonds ' , ' 2 of Diamonds ' , ' Ace of Diamonds ' , ' King of Diamonds ' , " Queen of Diamonds '" Jack of Diamonds ' , ' 10 of Clubs ' ,`'9 of Clubs ' , '8 of Clubs ' , '7 of Clubs ' , '6 of Clubs ' , '5 of Clubs' ,\\'4 Of Clubs ' ,' Ace of Clubs ' , ' King of Clubs ' ,S ', '3 of Clubs ' , ' 2 of Clubs" Queen of Clubs ' , ' Jack of Clubs ' , ' 10 of Spades ' , '9 of Spades' , ' 8 of Spades' ,`'7 of Spades ' , '6 of Spades15 of Spades' , '4 of Spades' , '3 of Spades' , '2 Of Spades', ' Ace of Spades', ' King of Spades', " Queen of Spades', ' Jack of Spades ' ]Values = [10 , 9 , 8 , 7 , 6 ,|5 , 4 , 3 , 2 , 1 , 10 , 10 , 10 , 10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 10 , 10 , 10 , 10 , 9 , 8, 7 , 6, 5 , 4 , 3 , 2, 1 , 10 , 10 , 10 , 10 , 91 8 , 7 , 6 , 5 , 4 , 3 , 2, 1 , 10 , 10 , 101Write a game of Blackjack that functions as follows :". Start by dealing two cards at random to the player . Store these cards and the associated values in separate lists . You should remove the two cards from the deck once theyhave been dealt to the player so they cannot be dealt a second time .. Report the player's hand as well as the value of their hand .. Next , ask the player if they want to " hit " or " stand " . " Hitting " means that the player wants another card . " Standing " means that the player is happy with their hand and doesn'twant any more cards .*. If the player chooses to " hit " you should deal them another card ( and remove it from the main deck ) . If their hand is worth 21 points they win the game . If their hand is over 21points they lose the game ( they went " bust " ) . If they have less than 21 points the process should be repeated ( they should be re-prompted to see if they want to " hit " or " stand " ). If the player chooses to " stand " they will have less than 21 points . Next , you need to give the computer the opportunity to beat the player's score . Begin by dealing two cards*to the computer and report the computer's hand and point value .". The computer should continually " hit " until one of the following conditions is met :". The computer gets 21 points ( blackjack )|. The computer earns more points than the player. The computer goes " bust " ( over 21 points ). If the computer did not go bust then you will need to make a final determination to see who is the winner . You can do this by seeing which player has more points .Here are some sample runnings of your program