Aug-18-2017, 08:08 PM
(Aug-18-2017, 06:41 PM)SummoningZ Wrote: Im not asking you to do it for me im just asking for some kind of idea of what im doing as all the stuff you are saying means nothing to me.
Pack =["JS","4C","KC","3H","5H","AD","10H","9H","7S","JD","6D","JC","2D","QC","5C","JH","4S","QS","8D","9D","4H"] First = Pack[0:7] Second = Pack[7:14] Third = Pack[14:21] print("1: " + " ".join([str(Pack) for Pack in First])) print("2: " + " ".join([str(Pack) for Pack in Second])) print("3: " + " ".join([str(Pack) for Pack in Third]))This is what I have done so far, is this how it should look?
For starters, printing a list can be easier than making a new list. Instead of
print("1: " + " ".join([str(Pack) for Pack in First]))
, you can do print("1: " + " ".join(First))
. It's simpler, and hopefully easier for you to understand.But aside from that, the Pack only has 21 elements in it. I think the first step would be to have a whole deck, shuffle it, and take the first 21 cards from it as the pack. Something like this (though, you might want to replace itertools with something, so it doesn't look like someone else did it for you :p ):
import itertools import random # all four suits suits = "DCHS" # all 10 numbers, and also Jack Queen King Ace numbers = list(map(str, range(2, 11))) + list("JQKA") # build a full deck of 52 cards full_deck = ["".join(pair) for pair in itertools.product(numbers, suits)] print(full_deck) # shuffle the deck, so it's randomized random.shuffle(full_deck) print(full_deck) # get a pack of the first 21 cards in the shuffled deck pack = full_deck[:21] print(pack)