Showing backside of deck of playing cards

I am writing a Python script for the card game Crazy Eights.
the following is code that I have managed to write up to date, but I am confused about how to
show the backside of all the COMPUTER cards. I have figured out how to display the first card
only but can’t get the rest.
I also have provided a screenshot of the current output for better understanding.

import random, sys
import subprocess as sp
from time import sleep

# set up the constants

HEARTS   = chr(9829) 
SPADES   = chr(9824)
DIAMONDS = chr(9830)
CLUBS    = chr(9827)

BACKSIDE = 'backside'

temp = sp.call('clear',shell=True)

def main():
	print()
	print(
		  """             \u001b[4mCrazy Eights\033[0m, the familiar card game written in Python.

                     By cogiz (cogiz@protonmailmail.com)

	\u001b[4mRules\033[0m:

	- Each player is dealt 8 cards

	- If a '2' is played, the opposing player must pick up 2 cards.

	- If a 'Jack' or 'J' is played then the opposing player loses 
	  their turn.

	- If the "Queen of Spades or the 'Bitch' is played then the 
	  opposing player must pick up 5 cards.

	- The game is over when either the player or Computer has 0 cards 
	  left in their hand.

	- The player to play first will be determined by random choice.

    	******************************************************************""")

	sleep(5)

	while True:     # main game loop

		# give dealer and player each 8 cards from the deck

		deck = getdeck()
		computerhand = [deck.pop(), deck.pop(), deck.pop(), deck.pop(), deck.pop(),deck.pop(), deck.pop(), deck.pop()]
		playerhand = [deck.pop(), deck.pop(), deck.pop(), deck.pop(), deck.pop(),deck.pop(), deck.pop(), deck.pop()]
		activecard = [deck.pop()]

		while True:

			temp = sp.call('clear',shell=True)
			displayhands(playerhand, computerhand, False)


def getdeck():

	""" Return a list of (rank,suit) tuples for all 52 cards."""

	deck = []
	for suit in (HEARTS, SPADES, DIAMONDS, CLUBS):
		for rank in range(2, 11):
			deck.append((str(rank), suit))   # add the numbered cards
		for rank in ('J', 'Q', 'K', 'A'):
			deck.append((rank, suit))   # add the Royals

	random.shuffle(deck)
	return deck

def displayhands(playerhand, computerhand, showcomputerhand):

	"""Show the player's and computer's cards. Show only backs of computer's cards
	if showdealerhand is False."""
	
	print()
	
	if showcomputerhand:
		print('COMPUTER:')
		displaycards(computerhand)
	else:
		print('COMPUTER:')
		displaycards([BACKSIDE] + computerhand[1::])
		
	# Show the player's cards:
	
	print('\033[22;0HPLAYER:')
	displaycards(playerhand)
		
def displaycards(cards):
	
	"""Display all the cards in the cards list."""
	
	rows = ['', '', '', '', '', '']  # The text to display on each row.
	
	for i, card in enumerate(cards):
		rows[0] += ' ___  '  # Print the top line of the card.
		
		if card == BACKSIDE:
		
			# Print the card's back:
			
			rows[1] += '|** | '
			rows[2] += '|***| '
			rows[3] += '|_**| '
		else:
		
			# Print the card's front.
			
			rank, suit = card  # The card is a tuple data structure.
			rows[1] += '|{} | '.format(rank.ljust(2))
			rows[2] += '| {} | '.format(suit)
			rows[3] += '|_{}| '.format(rank.rjust(2, '_'))
			
	# print each row on the screen:
	
	for row in rows:
		print(row)




if __name__ == '__main__':
	main()

for right now all I need to do do is make the other 7 cards in top row look like the first one.

thanks in advance for any assistance.
cogiz

Surely it’s just:

displaycards([BACKSIDE] * len(computerhand))

that was it. I was staring at it for so long that I couldn’t see the forest for the trees.
Thank you very much.

cogiz
python 3.6 user

Perhaps I’ve bitten off more than I can chew with my Crazy Eights project…
I am now having trouble printing the “Active card” or turnedup card in my game.
I would like it to appear in between the “COMPUTER” cards and the “PLAYER”
cards.
I’m thinking something like

print("\033[8;10HActive Card")
print("\033[8;0H", activecard)     # this is just an example

but I need it to display in the same format as the “COMPUTER” and “PLAYER” cards (screenshot provided).

this is the code I have so far:

import random
import subprocess as sp
from time import sleep

# set up the constants

HEARTS   = chr(9829) 
SPADES   = chr(9824)
DIAMONDS = chr(9830)
CLUBS    = chr(9827)

BACKSIDE = 'backside'

temp = sp.call('clear',shell=True)

def main():
	print()
	print(
		  """             \u001b[4mCrazy Eights\033[0m, the familiar card game written in Python.

                     By cogiz (cogiz@protonmailmail.com)

	\u001b[4mRules\033[0m:

	- Each player is dealt 8 cards

	- If a '2' is played, the opposing player must pick up 2 cards.

	- If a 'Jack' or 'J' is played then the opposing player loses 
	  their turn.

	- If the "Queen of Spades or the 'Bitch' is played then the 
	  opposing player must pick up 5 cards.

	- The game is over when either the player or Computer has 0 cards 
	  left in their hand.

	- The player to play first will be determined by random choice.

    	******************************************************************""")

	sleep(5)

	while True:     # main game loop

		# give dealer and player each 8 cards from the deck

		deck = getdeck()
		computerhand = [deck.pop(), deck.pop(), deck.pop(), deck.pop(), deck.pop(),deck.pop(), deck.pop(), deck.pop()]
		playerhand = [deck.pop(), deck.pop(), deck.pop(), deck.pop(), deck.pop(),deck.pop(), deck.pop(), deck.pop()]
		activecard = deck.pop()
		
		while True:

			temp = sp.call('clear',shell=True)
			displayhands(playerhand, computerhand, False)
						
def getdeck():

	""" Return a list of (rank,suit) tuples for all 52 cards."""

	deck = []
	for suit in (HEARTS, SPADES, DIAMONDS, CLUBS):
		for rank in range(2, 11):
			deck.append((str(rank), suit))   # add the numbered cards
		for rank in ('J', 'Q', 'K', 'A'):
			deck.append((rank, suit))   # add the Royals

	random.shuffle(deck)
	return deck

def displayhands(playerhand, computerhand, showcomputerhand):

	"""Show the player's and computer's cards. Show only backs of computer's cards
	if showdealerhand is False."""
	
	print()
	
	if showcomputerhand:
		print('COMPUTER:')
		displaycards(computerhand)
	else:
		print('COMPUTER:')
		displaycards([BACKSIDE] * len(computerhand))
		
	# Show the player's cards:
	
	print('\033[20;0HPLAYER:')
	displaycards(playerhand)
	
		
def displaycards(cards):
	
	"""Display all the cards in the cards list."""
	
	rows = ['', '', '', '', '', '']  # The text to display on each row.
	
	for i, card in enumerate(cards):
		rows[0] += ' ___  '  # Print the top line of the card.
		
		if card == BACKSIDE:
		
			# Print the card's back:
			
			rows[1] += '|** | '
			rows[2] += '|***| '
			rows[3] += '|_**| '
		else:
		
			# Print the card's front.
			
			rank, suit = card  # The card is a tuple data structure.
			rows[1] += '|{} | '.format(rank.ljust(2))
			rows[2] += '| {} | '.format(suit)
			rows[3] += '|_{}| '.format(rank.rjust(2, '_'))
			
	# print each row on the screen:
	
	for row in rows:
		print(row)

def displaycard():

		print("___")
		print("|{} |".format(rank))
		print("| {} |".format(suit))
		print("|{} |".format(rank, '_'))

		
if __name__ == '__main__':
	main()

I would truly appreciate any help you could provide.
Thank you in advance,
cogiz