Shuffling Algorithm

Our aim is to implement a shuffling algorithm to shuffle a deck of playing cards.

To do so, we will use a list called deck to store the 52 cards of the deck as follows:

Even though the random library already has a shuffle() function to shuffle the content of a list, we will ignore this function and create our own algorithm to shuffle the content of our deck of cards.

We will use the following algorithm to shuffle the deck:
flowchart-shuffling-deck-of-cards

Python Code


You can complete the Python code below to implement this algorithm.

Share Button
Tagged with: ,