python - Print List with Number of Players (Blackjack) -


so i'm writing blackjack program, i'm stuck on 1 part (which killing me arrghh).

i'm trying print multiple hands (list) corresponding players.

phands = [['9d', '2h'], ['ts', '2d], etc..] #this shuffled deck

ex. player n: [3h, ts]

here's code:

def print_blackjack(phands, num_of_players):     in phands:         num in range(num_of_players):             print('player' + str(num) + ':', i)     return 

it returns hands, each hand has multiple players associated it.

i know simple problem, mind giving me blank.

any help? thanks!

edit*** here's full code far

def make_deck():     # randomly shuffle deck     import random     cards = []     suit in ['h', 'c', 's', 'd']:         num in ['a', '2', '3', '4', '5', '6', '7', '8', '9', 't', 'j', 'q',                 'k']:             cards.append(num + suit)     random.shuffle(cards)     return cards deck = make_deck()   num_of_players = int(input("how many players?: "))  def deal_blackjack(deck, num_of_players):     # deal 2 cards number of players     hands = [[] p in range(num_of_players)]     = -1     k in range(0,2):         h in hands:             += 1             h.append(deck[i])     return hands  phands = deal_blackjack(deck, num_of_players)   def print_blackjack(phands, num_of_players):     print(list(enumerate(phands)))     return 

it should be:

def print_blackjack(phands):     in range(len(phands)):         print('player', i, ':', phands[i]) 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -