Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Similar to Poker
#1
Hello, I was wondering if someone could help me out with my program I am currently trying to make, my program is similar to poker were I am generating four random cards and being able to tell the six possible options,

This is my random card selector: (yes it works no problem with that...)
import random
card = random.choice( ('1''2','3','4','5','6','7','8','9') ) 
card2 = random.choice( ('1''2','3','4','5','6','7','8','9') )
card3 = random.choice( ('1''2','3','4','5','6','7','8','9') )
card4 = random.choice( ('1''2','3','4','5','6','7','8','9') )
print(card, card2, card3, card4)
For example when you run the program it will give you four random cards each tine such as: 3 8 7 4 or 9 9 1 4 or 5 4 7 1 (etc.)

My question is how can you get the program to tell the person, who runs the program, what set of cards is it.....

For example:
Output:
Four of a kind (7 7 7 7) Three of a kind (3 3 9 3) Two pair (4 7 4 7) Nothing (3 7 2 8) Four Consecutive (A straight) (2 4 3 5)
Any help would be appreciated... Thanks!
Reply
#2
Hello and welcome.
First, please put your code in Python code tags, you can find help here.

The most basic tip I can give is to first find the procedures/algorithms how a human would find an answer. Then translate it into code. If you are having problems with the second step, post your attempt and we can give you tips on how to tackle the problem.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sum similar items tester_V 3 1,899 Jun-29-2021, 06:58 AM
Last Post: tester_V
  Hi! + Poker calculator SpookyKooks 2 2,123 Mar-12-2020, 05:32 AM
Last Post: SpookyKooks
  Python: if 'X' in 'Y' but with two similar strings as 'X' DreamingInsanity 6 3,802 Feb-01-2019, 01:28 PM
Last Post: buran
  Poker Dice while loop gullidog 2 6,978 May-28-2017, 08:07 PM
Last Post: gullidog

Forum Jump:

User Panel Messages

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