Jan-05-2019, 07:40 PM
(Jan-05-2019, 07:15 PM)ichabod801 Wrote: You're not changing suit or rank for one thing, so yeah, they are always going to be the same. And you are creating them at random, rather than as a deck, so you could end up giving five twos of clubs to the same player.
Create a list of all the cards in the deck (looping through all of the ranks, then looping through all of the cards). Use random.shuffle to mix up the list. Deal the cards from the deck using pop or slicing.
ive done this and it still does not work. didnt understand what u mean
import itertools, random # make a deck of cards deck = list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club'])) # shuffle the cards random.shuffle(deck) i=int(input('how many are going to play?')) def poker(i): print("player", i,'gets') for i in range(5): print(deck[i][0], "of", deck[i][1]) i-=1 print(poker(i)) print(poker(i))