Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started