1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Oct 2013
Posts
24
Rep Power
0

#### Programming help needed!

I am trying to fix my generateDeck(), which assigns cards in reverse order and I think I accomplished that. However, I am trying to shuffle the cards 100 times and I am getting trouble modifying this part. May I have some assistance please, thanks!

Code:
```import random
import math

def generateDeck():

cards = [10,9,8,7,6,5,4,3,2]
cards.append('A')
cards.append('K')
cards.append('Q')
cards.append('J')

cards  = cards*4
random.shuffle(cards)
return cards```
2. No Profile Picture
Contributing User
Devshed Novice (500 - 999 posts)

Join Date
May 2009
Posts
530
Rep Power
34
You don't have any suits, and since you are using a random generator shuffling 100 times is no better than shuffling once.
Code:
```import random

cards = [10,9,8,7,6,5,4,3,2, 'A', 'K', 'Q', 'J']  ## you mix ints and strings
deck = []
for suit in ("C", "D", "H", "S"):
for card in cards:
deck.append(str(card)+suit)
print "Original deck", deck, "\n"
for ctr in range(100):
random.shuffle(deck)
print "Shuffled deck", deck```
3. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Oct 2013
Posts
24
Rep Power
0
The suits does not matter in this case.

Originally Posted by dwblas
You don't have any suits, and since you are using a random generator shuffling 100 times is no better than shuffling once.
Code:
```import random

cards = [10,9,8,7,6,5,4,3,2, 'A', 'K', 'Q', 'J']  ## you mix ints and strings
deck = []
for suit in ("C", "D", "H", "S"):
for card in cards:
deck.append(str(card)+suit)
print "Original deck", deck, "\n"
for ctr in range(100):
random.shuffle(deck)
print "Shuffled deck", deck```