File Edit Format Run Options Window Help dCardNames dCardValues ['2', '3', '4', '5', '6', = ['2', '3', '4', '5', '6' 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 = 0 while aCards [0] [i] aCards [0] [i+13] aCards [0] [i + 26] aCards [0] [i + 39] = dCardNames[i] i=i+1 aCards [1] [i] = dSuits [0] aCards [1] [i+13] aCards [1] [i+26] = dSuits [2] aCards [1] [i + 39] aCards [2] [i] aCards [2] [i+13] = = dSuits [3] dCardValues [i] dCardNames[i] dCardNames [i] dCardNames[i] dSuits [1] i < 52: print (aCards [0] [i], i = i + 1 '9', '10', 'J', 'Q','K','A'] '8', '9', '10', '10', '10', '10', '11'] " aCards [2] [i+26] =dCardValues[i] aCards [2] [i + 39] = dCardValues[i] dCardValues[i] " aCards [1] [i], " aCards [2] [i])

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter8: Arrays
Section: Chapter Questions
Problem 8E: Open the Calories Solution.sln file contained in the VB2017\Chap08\Calories Solution folder. Open...
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, then deal two hands. Comment (explain) your code.

 

ShuffleCards-1.py
File Edit Format Run Options Window Help
dCardNames = [¹2¹, ¹3¹, ¹4¹, ¹5¹, ¹6¹, 7¹ 8¹ '9', '10', 'J', 'Q', 'K', 'A']
['2', '3', '4', '5', '6', '7', '8', '9', '10', '10', '10', '10', '11']
dSuits = ["Clubs", "Spades", "Diamonds", "Hearts"]
dCardValues
#Build a two dimensional deck with Cards suits and values.
for i in range (52)] for j in range (3)]
aCards = [[¹
i = 0
n = 0
while i < 13:
=
- C:\Users\Justin\Downloads\ShuffleCards-1.py (3.10.7)
aCards [0] [i] = dCardNames [i]
aCards [0] [1 + 13] dCardNames [i]
aCards [0] [i + 26]
aCards [0] [139]
i=i+1
i = 0
while i < 52:
=
=
=
aCards [1] [i] = dSuits [0]
aCards [1] [i+13] = dSuits [1]
aCards [1] [i + 26]
dSuits [2]
dSuits [3]
aCards [1] [i + 39]
aCards [2] [1]
dCardValues[i]
aCards [2] [i+13] = dCardValues[i]
aCards [2] [i + 26] = dCardValues [i]
aCards [2] [i + 39]
dCardValues[i]
=
=
=
dCardNames [i]
dCardNames [i]
print (aCards [0] [i],
i = i + 1
aCards [1] [i], ", aCards [2] [i])
X
Ln: 31 Col: 0
Transcribed Image Text:ShuffleCards-1.py File Edit Format Run Options Window Help dCardNames = [¹2¹, ¹3¹, ¹4¹, ¹5¹, ¹6¹, 7¹ 8¹ '9', '10', 'J', 'Q', 'K', 'A'] ['2', '3', '4', '5', '6', '7', '8', '9', '10', '10', '10', '10', '11'] dSuits = ["Clubs", "Spades", "Diamonds", "Hearts"] dCardValues #Build a two dimensional deck with Cards suits and values. for i in range (52)] for j in range (3)] aCards = [[¹ i = 0 n = 0 while i < 13: = - C:\Users\Justin\Downloads\ShuffleCards-1.py (3.10.7) aCards [0] [i] = dCardNames [i] aCards [0] [1 + 13] dCardNames [i] aCards [0] [i + 26] aCards [0] [139] i=i+1 i = 0 while i < 52: = = = aCards [1] [i] = dSuits [0] aCards [1] [i+13] = dSuits [1] aCards [1] [i + 26] dSuits [2] dSuits [3] aCards [1] [i + 39] aCards [2] [1] dCardValues[i] aCards [2] [i+13] = dCardValues[i] aCards [2] [i + 26] = dCardValues [i] aCards [2] [i + 39] dCardValues[i] = = = dCardNames [i] dCardNames [i] print (aCards [0] [i], i = i + 1 aCards [1] [i], ", aCards [2] [i]) X Ln: 31 Col: 0
Expert Solution
steps

Step by step

Solved in 8 steps with 6 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
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT