Build a two dimensional array out of the following three lists. The array will represent a...

60.1K

Verified Solution

Question

Programming

Build a two dimensional array out of the following three lists.The array will represent a deck of cards. The values in dCardValuescorrespond to the card names in dCardNames. Note that when you makean array all data types must be the same. Apply dSuits todCardValues and dCardNames by assigning a suit to each set of 13elements.

  1. dCardNames =['2','3','4','5','6','7','8','9','10','J','Q','K','A']
  2. dCardValues =['2','3','4','5','6','7','8','9','10','11','12','13','14']
  3. dSuits = [\"Clubs\",\"Spades\",\"Diamonds\",\"Hearts\"]

Once assigned your two dimensional array should resemble this:

2 Clubs 2
3 Clubs 3
4 Clubs 4
5 Clubs 5
6 Clubs 6
7 Clubs 7
8 Clubs 8
9 Clubs 9
10 Clubs 10
J Clubs 11

Q Clubs 12
K Clubs 13
A Clubs 14
2 Spades 2
3 Spades 3
4 Spades 4
5 Spades 5
6 Spades 6
7 Spades 7
8 Spades 8
9 Spades 9
10 Spades 10
J Spades 11
Q Spades 12
K Spades 13
A Spades 14
2 Diamonds 2
3 Diamonds 3
4 Diamonds 4
5 Diamonds 5
6 Diamonds 6
7 Diamonds 7
8 Diamonds 8
9 Diamonds 9
10 Diamonds 10
J Diamonds 11
Q Diamonds 12
K Diamonds 13
A Diamonds 14
2 Hearts 2
3 Hearts 3
4 Hearts 4
5 Hearts 5
6 Hearts 6
7 Hearts 7
8 Hearts 8
9 Hearts 9
10 Hearts 10
J Hearts 11
Q Hearts 12
K Hearts 13
A Hearts 14

Once you have this two dimensional array, you should shuffle iteither by function or by code to produce a shuffled deck ofcards.

Randomly choose and extract five cards from the deck.

After that apply the selection sort to the two dimensional arrayreturning it to it original state as listed above. Display the 5cards selected and their indexes. Display the remaining deck withits indexes.  

Reshuffle and apply the insertion and selection sort.
IN PYTHON

Answer & Explanation Solved by verified expert
4.3 Ratings (566 Votes)
import random dCardNames 2345678910JQKA dCardValues 234567891011121314 dSuits ClubsSpadesDiamondsHearts def shuffledeck for i in rangelendeck101 r randomrandint0i    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students