import random def draw_card(): #returns a random number between 1 and 10. return random.randint(1, 10) def player_turn(name): print(f"\n{name}'s turn!\n") total = 0 #card draw loop while True: card = draw_card() print(f"{name} drew a {card}.") total = total + card if total <= 21: print(f"Current total: {total}") else: print(f"Your total is {total}! BUST!!") break choice = input("Do you want to draw another card? (yes/no): ").lower() if choice != 'yes': break return total def determineWinner(p1, s1, p2, s2): print(f"\n{p1}'s total: {s1}") print(f"{p2}'s total: {s2}") if s1 <= 21 and s1>s2: print(f"{p1} wins!") elif s2 <= 21 and s2 > s1: print(f"{p2} wins!") else: print("Nobody won!") def getPlayerName(playerNum): return input(f"Enter player{playerNum} name:") def play_game(): print("Welcome to Busted!") player1 = getPlayerName(1) player2 = getPlayerName(2) #player1 turn score1 = player_turn(player1) #player2 turn score2 = player_turn(player2) determineWinner(player1, score1, player2, score2) # Run the game def main(): play_game() #call main! main()