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 496 Jun-29-2021, 06:58 AM
Last Post: tester_V
  Calculate the value which has the similar name in the header using - XLSWRITER using rsd 1 589 Apr-06-2021, 10:27 AM
Last Post: Larz60+
  Hi! + Poker calculator SpookyKooks 2 1,189 Mar-12-2020, 05:32 AM
Last Post: SpookyKooks
  Count elements in a list only if they are following each other and are similar law 10 2,219 Aug-02-2019, 10:54 PM
Last Post: law
  spliting similar but multiple lines anna 7 1,880 Apr-20-2019, 08:53 AM
Last Post: anna
  Python: if 'X' in 'Y' but with two similar strings as 'X' DreamingInsanity 6 1,914 Feb-01-2019, 01:28 PM
Last Post: buran
  finding similar objects in a list DRPR 4 2,738 Jun-22-2018, 10:05 AM
Last Post: volcano63
  Poker Dice while loop gullidog 2 3,436 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