Question: ( 1 ) Define a function which will draw a poker card from the top of deck. In the function, convert card names to points:
Define a function which will draw a poker card from the top of deck.
In the function, convert card names to points:
Ace: points
Jack: points
Queen: points
King: points
thers: points card face number
Return will be the card's points and card name.
Write a driver program to test the function above
use a loop to draw as many cards as user wants
use a list to hold the returned points
use a list to hold the returned names
finally, print out total points and all cards names
drawing card without replacing.
Coding here:
# A deck list of shuffled poker cards is given
import random
# deck: given list of poker cards.
values "ace", "jack", "queen", "king"
suits "clubs", "diamonds", "hearts", "spades"
deck of for in suits for in values
random.shuffledeck
deck
# printdeck
#
# your function
should me look like below :
Sample Run
card name: ofdiamonds, point:
play againanykey or exit y:
card name: ofdiamonds, point:
play againanykey or exit y:
card name: ofclubs, point:
play againanykey or exit y:
card name: ofspades, point:
play againanykey or exit y:y
Total points:
They are: ofdiamonds', ofdiamonds', ofclubs', ofspades'
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
