Displaying a single card as opposed to multiple in python crazy eights

filename = crazy.py

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():
		  """             \u001b[4mCrazy Eights\033[0m, the familiar card game written in Python.

                     By cogiz (cogiz@protonmailmail.com)


	- 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.



	while True:     # main game loop

		# give dealer and player each 8 cards from the deck and turn up 'active card'.

		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)
			print("\033[10;0HActive card")
def getdeck():

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

	deck = []
		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

	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."""
	if showcomputerhand:
		displaycards([BACKSIDE] * len(computerhand))
	# Show the player's cards:

	print('\033[12;0HActive card', (activecard))

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] += '|_**| '

			# 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:

def activecard(card):

	for i, card in enumerate(cards):

		rank, suit = card
		print('|{} |'.format(rank.ljust(2)))
		print('| {} |'.format(suit))
		print('|_{}|'.format(rank.rjust(2), '_'))

if __name__ == '__main__':

in the above code, I can’t seem to get the ‘active card’ to print as a single card
in between ‘COMPUTER’ and ‘PLAYER’ on the screen. I keep getting card is not
defined error.
Does it have something to do with the enumerate() function?

see screenshot attached:

I know I have probably bitten off more than I can chew with this project, but I am
learning alot.
any help is greatly appreciated.
Thank you,

In main it calls getdeck to create the deck, which is a list of tuples. It pops a card off the deck (activecard) and in the while loop it tries to call that card, but it’s a tuple; it can’t be called.

There’s a function called activecard, but it expects to be passed a card, and it refers to cards, but there’s no variable either locally or globally with that name. I think that the enumeration in that function is extraneous as it’s meant to be displaying only a single card, one that’s passed in.