Himan10 / BlackJack

Hand of Black Jack ...
8 stars 7 forks source link

another idea #5

Open SpudGunMan opened 2 months ago

SpudGunMan commented 2 months ago

you asked about any other ideas, I changed the copy I am using for the choice to just accept single letters

    if choice == "hit" or choice == "h":
        # hits(obj_de, obj_h)
        obj_h.add_cards(next_card)
        show_some(obj_h.cards, dealer_card, obj_h)
    elif choice == "stand" or choice == "s":
        playingBlackJack = False
    elif choice == "forfit" or choice == "f":
        p_chips.bet = p_chips.bet / 2
        playingBlackJack = False
        obj_h.value += 21
    elif choice == "double" or choice == "d":
Himan10 commented 1 month ago

little addition can be made to the above conditional statements, so as we just want to check if the variable choice contains a specific value or not, it'd be a better idea to compare it against a tuple containing numerous possible values.

For example: elif choice in ("forfit", "f")

this way we can append more values to the tuple and use the in operator to check whether a value exists in the given sequence or not.