create_deck(): Creates a deck of 52 cards using the abbreviations outlined in the requirements. Input parameters: None. Return value: a list of cards, not shuffled.
create_deck(): Creates a deck of 52 cards using the abbreviations outlined in the requirements. Input parameters: None. Return value: a list of cards, not shuffled.
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
Related questions
Question
100%
This is python card of deck questions, please help and fix heres my code, i want to be like the output original deck.
import random
def card_draw ( ):
suits = ["spade", "club", "heart", "diamond"]
faces = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]
deck = [ ]
for suit in suits:
for face in faces:
deck.append((suit, face))
card = random.choice(deck)
deck.remove(card)
suit1, face1 = card
def main():
card_draw()
# card = random.choice(deck)
# deck.remove(card)
#suit1, face1 = card
main()
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT