Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

Write a program that scores a blackjack hand. First, ask the player how many cards they have in their hand. In blackjack, a player can have between 2 and 5 cards. If they enter an invalid value (a number less than two or greater than 5) ask them to enter

Write a program that scores a blackjack hand. First, ask the player how many cards they have in their hand. In blackjack, a player can have between 2 and 5 cards. If they enter an invalid value (a number less than two or greater than 5) ask them to enter

Write a program that scores a blackjack hand. First, ask the player how many cards they have in their hand. In blackjack, a player can have between 2 and 5 cards. If they enter an invalid value (a number less than two or greater than 5) ask them to enter

Question Description

Note: Your program does not need to actually play a round of Blackjack. All it needs to do is ask the user how many cards they have (between 2 and 5), and then ask for the value of each. For example, if the user enters ‘3’, ask for the values of the 1st, 2nd, and 3rd cards.

Write a program that scores a blackjack hand. First, ask the player how many cards they have in their hand. In blackjack, a player can have between 2 and 5 cards. If they enter an invalid value (a number less than two or greater than 5) ask them to enter a valid number.

Once they have entered a valid number, ask them what value each of their cards has. In Blackjack, each card can have a numeric value (2, 3, 4, 5, 6, 7, 8, 9, and 10) or a letter value (‘j’, ‘q’, ‘k’, and ‘a’ for the face cards ‘jack’, ‘queen’, king’, and ‘ace’). You do not need to perform input validation on the card values. You may assume they will properly enter a valid number or character.

After the card values are entered, add up their score. To do this, follow these steps:

  • A numeric card adds its value to the final score. For example, if the user has a 2 in their hand, it adds 2 points to the total. If the user has an 8 in their hand, it adds 8 points to the total.
  • A face card (Jack, Queen, and King) adds 10 points each to the total.
  • An ace card adds either 1 or 11 to the total, whichever is more helpful for the player.

The goal of blackjack is to score as close to 21 as possible without going over. After the total score is calculated, tell the user how they did :

  • If total is over 21, the player has “busted” and automatically loses.
  • If total is 21, the player has received a “blackjack”.
  • If total is less than 21, the player can simply be told score they have received.

Tip: Remember that the input function returns a string value. When adding the numbers from your list to the total, you want to make sure to convert them to integers. Any face cards (‘j’, ‘q’, ‘k’) can’t be converted to numbers, but you can use an if statement to add their value to the total.

Example hand: The user has an ace and two 8s. This can either be scored as 17 (with the ace counting as 1 point) or 27 (with the ace counting as 11 points). Since 27 is a bust, the user’s score should be calculated as 17.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Essay Noon only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Essay Noon are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Essay Noon are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Essay Noon, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20