#imports import random import time #card value numbers_value = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'] card_values = {'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10, 'J': 10, 'Q': 10, 'K': 10, 'A': 1} score = 0 hit = "y" #game start while score < 21 and hit == "y": num1 = random.choice(numbers_value) card_value = card_values[num1] print(f"You drew a {num1}.") score += card_value print(f"Your current score is: {score}") if score < 21: hit = input("Do you want to hit or stand? (y/n): ").lower() time.sleep(1) #End game if score > 21: print(f"Your score is {score}. You busted! Game over.") else: print(f"Your final score is {score}.")