Python Forum
Checking for one or more occurrence in a list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Checking for one or more occurrence in a list
#4
I did a Texas hold'm in python.
This is how i defined the deck(s)
deck = []
d = ['A','2','3','4','5','6','7','8','9','X','J','Q','K']
t = ['H','S','D','C']

for card in d:
    for f in t:
        deck.append(f + card)           
random.shuffle(deck)
The harder part is determining who won :-)
(I do have a copy of Fluent Python, but i did not know about the card game.
I'll have a look later on)
Paul
Reply


Messages In This Thread
RE: Checking for one or more occurrence in a list - by DPaul - May-18-2020, 06:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Checking if a string contains all or any elements of a list k1llcod3 1 1,140 Jan-29-2023, 04:34 AM
Last Post: deanhystad
  How to get unique entries in a list and the count of occurrence james2009 5 3,023 May-08-2022, 04:34 AM
Last Post: ndc85430
  Selecting the first occurrence of a duplicate knight2000 8 5,297 May-25-2021, 01:37 AM
Last Post: knight2000
  Checking number in a list to see if they are beside each other Allaye 5 5,924 Aug-26-2019, 07:15 AM
Last Post: perfringo
  Checking for an item in a list (if then statement) Sailnir 1 2,083 Jul-18-2019, 05:36 PM
Last Post: ndc85430
  count occurrence of numbers in a sequence and return corresponding value python_newbie09 6 3,535 May-20-2019, 06:33 PM
Last Post: python_newbie09
  Word co-occurrence matrix for a string (NLP) JoeB 2 11,666 Feb-27-2018, 11:21 PM
Last Post: Larz60+
  Maximum Occurrence Letter GalaxyCR 2 3,939 Nov-27-2017, 09:00 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020