Chose Your Difficulty
Chose Your Difficulty
Cards are not removed from the deck as they are drawn.
https://games.washingtonpost.com/games/blackjack/
https://appbrewery.github.io/python-day11-demo/
http://listmoz.com/view/6h34DJpvJBFVRlZfJvxF
https://drive.google.com/uc?
export=download&id=1rDkiHCrhaf9eX7u7yjM1qwSuyEk-rPnt
Create a deal_card() function that uses the List below to return a random
card.
cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]
Deal the user and computer 2 cards each using deal_card() and append().
user_cards = []
computer_cards = []
Inside calculate_score() check for a blackjack (a hand with only 2 cards: ace
+ 10) and return 0 instead of the actual score. 0 will represent a blackjack in
our game.
Inside calculate_score() check for an 11 (ace). If the score is already over 21,
remove the 11 and replace it with a 1. You might need to Google to find the
documentation on the Python built-in functions append() and remove().
https://developers.google.com/edu/python/lists#list-methods
If the game has not ended, ask the user if they want to draw another card. If
yes, then use the deal_card() function to add another card to
the user_cards List. If no, then the game has ended.
The score will need to be rechecked with every new card drawn and the
checks in Hint 9 need to be repeated until the game ends.
Once the user is done, it's time to let the computer play. The computer
should keep drawing cards as long as it has a score less than 17.
If the computer and user both have the same score, then it's a draw.
Ask the user if they want to restart the game. If they answer yes, clear the
console and start a new game of blackjack and show the logo from art.py.