Display all the cards in the cards list.
(cards)
| 193 | |
| 194 | |
| 195 | def displayCards(cards): |
| 196 | """Display all the cards in the cards list.""" |
| 197 | rows = ['', '', '', '', ''] # The text to display on each row. |
| 198 | |
| 199 | for i, card in enumerate(cards): |
| 200 | rows[0] += ' ___ ' # Print the top line of the card. |
| 201 | if card == BACKSIDE: |
| 202 | # Print a card's back: |
| 203 | rows[1] += '|## | ' |
| 204 | rows[2] += '|###| ' |
| 205 | rows[3] += '|_##| ' |
| 206 | else: |
| 207 | # Print the card's front: |
| 208 | rank, suit = card # The card is a tuple data structure. |
| 209 | rows[1] += '|{} | '.format(rank.ljust(2)) |
| 210 | rows[2] += '| {} | '.format(suit) |
| 211 | rows[3] += '|_{}| '.format(rank.rjust(2, '_')) |
| 212 | |
| 213 | # Print each row on the screen: |
| 214 | for row in rows: |
| 215 | print(row) |
| 216 | |
| 217 | |
| 218 | def getMove(playerHand, money): |