import random name1 = input("What is your name? ") player = 0 dealer = 0 card = 0 card_name = 0 dealer_card = 0 print("are you ready to play some 21 cards?") print("Do you want to play 21 cards?") keep_going = input("[Y] yes or [N] no? ") while keep_going == "y" and player < 22 and dealer < 22: card = random.randint(2, 11) if card == 11: print("Do you want to keep the 11 or make it a 1?") choice = int(input("Enter 1 for 1 or any other number for 11: ")) card = 1 if choice == 1 else 11 player += card card = random.randint(2, 11) if card == 11: dealer_card = random.randint(1, 2) card = 1 if dealer_card == 1 else 11 dealer += card print(f"{name1} you have {player} amount of points.") print(f"the dealer has {dealer} points.") if player > 21 or dealer > 21: break keep_going = input("Do you wish to continue? [Y] yes or [N] no? ") while keep_going == "n" or "N" : break def winner(player, dealer): if player > 21 and dealer > 21: return "both busted" elif player > 21: return "dealer wins" elif dealer > 21: return "player wins" else: if player(21 - dealer) < dealer(21 - player): return "player wins" else: return "dealer wins" if keep_going == "n" : print("Well well well") print("you chose to end this game") print("lets see if you won or not") print("you ", name1, "have ", player, "amount of points") print("the dealer has ", dealer, "amount of points") if winner == "player wins" : print(name1, "wins") else : print("Dealer wins") if player >21 : print("you bust you lose you idiot") if dealer > 21 : print("dealer busts you win")