Score not updating properly in Blackjack game

Replit link:

Having issues with my code where when I get a 11 in my hand, and the code runs my ace_check function to update my score appropriately, the score doesnt seem to change because the print statement code still prints:

if draw + score > 21:
          score += sum(initial_hand) - score
          ace_check(initial_hand, score)
          if score > 21:
            score += sum(initial_hand) - score
            print(f"Your final hand: {initial_hand}, final score: {score}")
            print(f"Computer's final hand: {computers_first_card}")
            print("You Lose!")
            playing_game = False

I want that code to skip but it still gets run. Which is why I assume the score isnt updating from ace_check like I want it to.

I spent all weekend, but I can’t understand the logic of whats going on. Sorry, but could someone shine some light on what is befuddling me?

Hey @apollosol when you call ace_check(), for the score variable to be updated, you actually need to assign to the score variable: score = ace_check(initial_hand, score). Hope this helps!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.