May-18-2020, 01:08 AM
I'm going to try my luck with a simple 5 card stud poker game but, I've ran into a roadblock.
What is going to be the best way to compare the cards.
I'm speculating that I'm going too have to do a split to have access to both left and right of a card element.
Any guidance is much appreciated.
What is going to be the best way to compare the cards.
I'm speculating that I'm going too have to do a split to have access to both left and right of a card element.
Any guidance is much appreciated.
#! /usr/bin/env python3 import random as rnd card_types = ['Spades', 'Hearts', 'Diamonds', 'Clubs'] cards = ['Ace', 2, 3, 4, 5, 6, 7, 8 , 9, 10, 'Jack', 'Queen', 'King'] deck = [] hand = [] for card in cards: for card_type in card_types: deck.append(f'{card} {card_type}') rnd.shuffle(deck) for i in range(5): hand.append(deck.pop()) print(hand)
Output:['8 Diamonds', '6 Spades', '8 Spades', 'King Clubs', 'King Hearts']