Read the title bruh. It's a basic blackjack game. Copy paste the code down there
import random, time cash = 1000 bet = 0 turn = 'someone' endgame = False def askCashBet(cash): print('You got ' + str(cash) + ' cash! How much do you want to bet?') while True: answer = input() if answer[0] in ('1 2 3 4 5 6 7 8 9 0').split(): answer = int(answer) if answer > cash: print('You don\'t have enough cash to bet ' + str(answer)) elif answer == 0: print('Please bet something') else: return answer else: print('Please enter a NUMBER.') def askRollAgain(): print('Do you want to roll again?') while True: answer = input().lower() if answer in ('yes y no n nope yeah').split(): if answer in ('yes y yeah').split(): return True else: return False else: print('Please enter YES or NO.') def getNumber(turn): dice1 = random.randint(1,6) dice2 = random.randint(1,6) number = dice1 + dice2 if turn == 'computer': print('He got ' + str(number), end= '') else: print('You got ' + str(number), end= '') return number #==============MAIN=============== print('Welcome to Blackjack! Try to make as much money as you can!') while not endgame: bet = askCashBet(cash) playerNumber = 0 computerNumber = 0 playerStopped = False computerStopped = False gamePlaying = True if random.randint(0,1) == 0: turn = 'computer' print('The computer starts first') time.sleep(2) computerNumber += getNumber(turn) turn = 'player' print('\nIt\'s your turn') time.sleep(2) playerNumber += getNumber(turn) turn = 'computer' print('\nIt\'s the computer\'s turn') time.sleep(2) else: turn = 'player' print('You start first') time.sleep(2) playerNumber += getNumber(turn) turn = 'computer' print('\nIt\'s the computer\'s turn') time.sleep(2) computerNumber += getNumber(turn) turn = 'player' print('\nIt\'s your turn') time.sleep(2) while gamePlaying: if turn == 'computer': if computerNumber <= 14: computerNumber = computerNumber + getNumber(turn) print(' with a total of ' + str(computerNumber) + ' points') elif computerNumber < playerNumber: computerNumber += getNumber(turn) print(' with a total of ' + str(computerNumber) + ' points') else: print('He stops rolling') computerStopped = True if (playerStopped and computerStopped) or computerNumber > 21: gamePlaying = False break turn = 'player' print('It\'s your turn') time.sleep(2) if turn == 'player': if askRollAgain(): playerNumber += getNumber(turn) print(' with a total of ' + str(playerNumber) + ' points') else: playerStopped = True if (computerStopped and playerStopped) or playerNumber > 21: gamePlaying = False break turn = 'computer' print('It\'s the computer\'s turn') time.sleep(2) if playerNumber > 21: print('You lost! You lost ' + str(bet) + ' cash!') cash -= bet elif computerNumber > 21: print('You won! You won ' + str(bet) + ' cash!') cash += bet elif 21 - computerNumber < 21 - playerNumber: print('You lost! You lost ' + str(bet) + ' cash!') cash -= bet elif 21 - computerNumber > 21 - playerNumber: print('You won! You won ' + str(bet) + ' cash!') cash += bet elif computerNumber == playerNumber: print('You got the same number as the computer! No one won.') else: print('Well, well... looks like you got an error!') print('Do you want to play again?') while True: if cash != 0: answer = input().lower() if answer in ('yes y no n nope yeah').split(): if answer not in ('yes y yeah').split(): endgame = True break else: gamePlaying = True break else: print('Please enter YES or NO.') else: print('Wait you can\'t! You are ruined!') endgame = True break