print('\ \ ' show the final hands displayhands(playerhanddealerhandtrue playervalue gethandvalue(playerhand dealervalue gethandvalue(dealerhand handle whether the player wonlostor tied if dealervalue print('dealer bustsyou win ${}!format(bet) money +bet elif (playervalue or (playervalue dealervalue) print('you lost!' money -bet elif playervalue dealervalue print('you won ${}!format(bet) money +bet elif playervalue =dealervalue print('it\' tiethe bet is returned to you ' input('press enter to continue ' print('\ \ ' def getbet(maxbet) """ask the player how much they want to bet for this round "" while truekeep asking until they enter valid amount print('how much do you bet( -{}or quit)format(maxbet) bet input(''upper(strip( if bet ='quit' print('thanks for playing!' sys exit( if not bet isdecimal() continue if the player didn' enter numberask again bet int(bet if <bet <maxbet return bet player entered valid bet def getdeck() """return list of (ranksuittuples for all cards "" deck [ for suit in (heartsdiamondsspadesclubs) for rank in range( ) deck append((str(rank)suit)add the numbered cards for rank in (' '' '' '' ') deck append((ranksuit)add the face and ace cards random shuffle(deck return deck def displayhands(playerhanddealerhandshowdealerhand) """show the player' and dealer' cards hide the dealer' first blackjack