Python Forum
Similar to Poker - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Similar to Poker (/thread-14082.html)



Similar to Poker - bluekade5050 - Nov-14-2018

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!


RE: Similar to Poker - j.crater - Nov-14-2018

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.