Score not updating properly in Blackjack game

Replit link:
https://replit.com/@AbrahamFrancis1/blackjack-start#main.py

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:
          initial_hand.append(draw)
          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
            play_again()

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.