Search for question
Question

You are tasked with implementing three functions to help calculate the value of Blackjack hands.

Write a file called blackjack.py that has:

a function called card_to_value(card) - this function takes as input a str variable

card. This represents a single card in blackjack. Either "2" through "9", "T" for ten, "J" for

Jack, "Q" for Queen, "K" for King, or "A" for Ace. This function returns the numeric

blackjack score of the card. For "A", this function should return 1, not 11. For "T" and the

face cards "J", "Q", "K", it should return 10. All other cards should return their int value

(example, "8" returns 8).

You do not have to worry about "invalid" card values. That is, we will only test your code with

valid card values.

a function called hard_score (hand) - this function takes in a hand as a string, where

each character is a card. For example, the string "J2A" means a Jack, a 2, and an Ace.