We are supposed to make a dealer and a player function for blackjack and then combine them into another function. I don't really know how to go about doing that. We also need to include the amount of times the player has won out of the number of games played.
import random
def play_hand_player():
    total=0
    player_is_bust=False
    ace_was_thrown=False
    more='y'
    while (more!='n') and not(player_is_bust):
        card=random.choice([1,2,3,4,5,6,7,8,9,10,10,10,10])
        total=total+card
        if (card==1):  #runs if the card is equal to one
            ace_was_thrown=True
            print("Ace\t ",end='')
        else:
            print(card,"\t",end='')
        if (total>21):  #runs if the card total is over 21
            player_is_bust=True
        if not (player_is_bust):
            print("New total: ",end="")
            if (ace_was_thrown) and (total+10<22):
                print(total,"or",total+10,end="")
            else:
                print(total,end="")
            more=input("\tAnother Card? ")        
        if (player_is_bust):
            print("Bust")
        if (more=="n"):
            if (ace_was_thrown==True)and(total+10<17)and(total+10>22):
                print("\tFinal Total: ",total+10)
            else:
                print("\tFinal Total: ",total)
        print("")
def play_hand_dealer():
    total = 0                  
    dealer_is_under = True     
    dealer_is_bust = False     
    ace_was_thrown = False    
    while (dealer_is_under):
        card=random.choice([1,2,3,4,5,6,7,8,9,10,10,10,10])
        total = total + card
        if (card == 1):
            ace_was_thrown = True
            print ("Ace ", end = "")
        else:
            print (card," ", end = "")
        if (total>16):
            dealer_is_under = False
        if (total>21):
            dealer_is_bust = True
        if (ace_was_thrown) and (total + 10 > 16) and (total + 10 < 22):
            dealer_is_under = False
            total = total + 10
    if (dealer_is_bust):
        print (" Bust")
    else:
        print (" Total:", total)
    print ("Instructions: Press Enter Key to play another game, 'q' to quit.\n")
def blackjack():
    gamesWon = 0 
    totalHandsPlayed = 0 
    player = play_hand_player() 
    dealer = play_hand_dealer()
    if player > dealer: 
        gamesWon += 1 
        print ("PLAYER WINS, ")
    else:
        print ("DEALER WINS. ")
 
    