# 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

I’m working on a Python question and need guidance to help me study.

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.