In the attached Python code, use the array built to shuffle and deal two poker hands. Change the corresponding values for all Jacks through Aces to 11, 12, 13, 14 respectively. Shuffle the deck using your written shuffle routine, then deal two hands. COMMENT (explain) YOUR CODE Code: dCardNames = ['2','3','4','5','6','7','8','9','10','J','Q','K','A'] dCardValues = ['2','3','4','5','6','7','8','9','10','10','10','10','11'] dSuits = ["Clubs","Spades","Diamonds","Hearts"] # Build a two dimensional deck with Cards suits and values. aCards = [['' for i in range(52)] for j in range(3)] i = 0 n = 0 while i < 13: aCards[0][i] = dCardNames[i] aCards[0][i + 13] = dCardNames[i] aCards[0][i + 26] = dCardNames[i] aCards[0][i + 39] = dCardNames[i] aCards[1][i] = dSuits[0] aCards[1][i + 13] = dSuits[1] aCards[1][i + 26] = dSuits[2] aCards[1][i + 39] = dSuits[3] aCards[2][i] = dCardValues[i] aCards[2][i + 13] = dCardValues[i] aCards[2][i + 26] = dCardValues[i] aCards[2][i + 39] = dCardValues[i] i = i + 1 i = 0 while i < 52: print (aCards[0][i], " ", aCards[1][i], " ", aCards[2][i]) i = i + 1

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
In the attached Python code, use the array built to shuffle and deal two poker hands. Change the corresponding values for all Jacks through Aces to 11, 12, 13, 14 respectively. Shuffle the deck using your written shuffle routine, then deal two hands. COMMENT (explain) YOUR CODE Code: dCardNames = ['2','3','4','5','6','7','8','9','10','J','Q','K','A'] dCardValues = ['2','3','4','5','6','7','8','9','10','10','10','10','11'] dSuits = ["Clubs","Spades","Diamonds","Hearts"] # Build a two dimensional deck with Cards suits and values. aCards = [['' for i in range(52)] for j in range(3)] i = 0 n = 0 while i < 13: aCards[0][i] = dCardNames[i] aCards[0][i + 13] = dCardNames[i] aCards[0][i + 26] = dCardNames[i] aCards[0][i + 39] = dCardNames[i] aCards[1][i] = dSuits[0] aCards[1][i + 13] = dSuits[1] aCards[1][i + 26] = dSuits[2] aCards[1][i + 39] = dSuits[3] aCards[2][i] = dCardValues[i] aCards[2][i + 13] = dCardValues[i] aCards[2][i + 26] = dCardValues[i] aCards[2][i + 39] = dCardValues[i] i = i + 1 i = 0 while i < 52: print (aCards[0][i], " ", aCards[1][i], " ", aCards[2][i]) i = i + 1
< Back
dCardNames =
['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A
dCardValues =
I
I
['2', '3', '4', '5 6
I
ShuffleCards.py
,'11']
dSuits =
["Clubs", "Spades", "Diamonds", "Hearts"]
# Build a two dimensional deck with Cards suits and
values.
aCards = [['' for i in range(52)] for j in
range (3)]
i = 0
n = 0
while i < 13:
i=i+1
i = 0
while i < 52:
aCards [0] [i] = dCardNames[i]
aCards[0][i+13] =dCardNames [i]
aCards[0][i + 26] =dCardNames[i]
aCards[0][i + 39] =dCardNames [i]
aCards [1] [i]
dSuits [0]
=
dSuits [2]
aCards [1] [i+13] = dSuits [1]
aCards [1] [i + 26]
aCards [1] [i +39] dSuits [3]
aCards [2] [i] =dCardValues[i]
aCards [2] [i + 13] = dCardValues[i]
aCards [2] [i+26] = dCardValues[i]
aCards [2] [i + 39] dCardValues[i]
=
aCards [2] [i])
I
'8', '9', '10', '10', '10', '10'
i=i+1
=
print (aCards[0][i],
=
I
aCards [1] [i],
Transcribed Image Text:< Back dCardNames = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A dCardValues = I I ['2', '3', '4', '5 6 I ShuffleCards.py ,'11'] dSuits = ["Clubs", "Spades", "Diamonds", "Hearts"] # Build a two dimensional deck with Cards suits and values. aCards = [['' for i in range(52)] for j in range (3)] i = 0 n = 0 while i < 13: i=i+1 i = 0 while i < 52: aCards [0] [i] = dCardNames[i] aCards[0][i+13] =dCardNames [i] aCards[0][i + 26] =dCardNames[i] aCards[0][i + 39] =dCardNames [i] aCards [1] [i] dSuits [0] = dSuits [2] aCards [1] [i+13] = dSuits [1] aCards [1] [i + 26] aCards [1] [i +39] dSuits [3] aCards [2] [i] =dCardValues[i] aCards [2] [i + 13] = dCardValues[i] aCards [2] [i+26] = dCardValues[i] aCards [2] [i + 39] dCardValues[i] = aCards [2] [i]) I '8', '9', '10', '10', '10', '10' i=i+1 = print (aCards[0][i], = I aCards [1] [i],
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Array
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning