Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python only Blackjack is a card game sometimes called Twenty-One. The object of Blackjack is to have a hand of cards whose score is

image text in transcribed

use python only

Blackjack is a card game sometimes called Twenty-One. The object of Blackjack is to have a hand of cards whose score is 21, or as close to this as possible. A player whose hand exceeds a score of 21 is said to have bust and loses. A hand in Blackjack is scored as follows: - Cards 2 to 10 are given their card value as points (i.e. 2 to 10 points). - Face cards (the Jack, Queen and King) are all worth 10 points. - The Ace card is worth 11 points, or 1 point if doing so prevents the player from going bust. For example, if a player's hand has three Aces and a 6, one of the Aces will be worth 11 points, while the other two will be worth 1 point, making the score for the hand 19(11+1+1+6). If all three Aces are worth 11 , then the score for the hand would be 39(11+11+11+6) and the player would be bust. Similarly, if two of the Aces are worth 11 points, then the score of the hand would be 29(11+11+1+6) and the player would also be bust. Write a program which asks the user to enter a hand and then calculates its score. The cards in a hand are represented as characters: - Cards 2 to 10 are represented as "2", "3", .., "10". - Face cards (the Jack, Queen and King) are represented as "J", "Q" and "K". - The Ace card is represented as "A". The user will enter the a hand as a string of characters representing cards, separated by comas. E.g.: "A, K, 7" for Ace, King, 7

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions