for i, j in cards:
# cards = a list containing list of cards - RANDOM OUTPUTS, more pairs can be added to the list depending on the number that the user puts in
print(i)
print(j)
print("\t")
How do I make it so that the output becomes:
TS 6S JS
AH 5S AS
Instead of:
TS
AH
6S
5S
JS
AS
I posted a question similar to this but I wasn't being specific enough, and I edited too late. Apologies in advance
EDIT - 'cards' code:
deck = deck_create()
def deal_cards(deck, num_players):
cards= []
for i in range(num_players):
hands.append([deck.pop(), deck.pop()])
return hands
You could get a little fancy and use zip(*) to transpose cards. Then printing is simple, like this:
cards=[("TS", "AH"), ("6S", "5S"), ("JS", "AS")]
for round in zip(*cards):
print('\t'.join(round))
output:
TS 6S JS
AH 5S AS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With