I am interested in the frequency of 10 hands:

Royal Flush (10, Jack, Queen, King, Ace, all of the same suit)

Straight Flush (ﬁve ranks in a row, all of the same suit)

Four of a Kind (four cards of the same rank)

Full House (three of one rank and two of another)

Flush (ﬁve cards of the same suit); Straight (ﬁve ranks in a row)

Three of a Kind (three of one rank, but not a full house or four of a kind)

Two Pair (two each of two di"erent ranks)

Pair (two of the same rank, but not Two Pair, three or four of a kind)

High Card (if none of the previous categories ﬁt)

I don't quite know how to start the program but this is what I have so far:

import time import random flush=0 royal=0 n=int(input("number of hand=")) t1=time.clock() for i in range(n): count1=count2=count3=count4=0 for i in range(0,5): card=random.choice(['a',2,3,4,5,6,7,8,9,10,'j','q','k']) suit=random.choice(['s','d','h','c']) if suit=='s': count1+=1 elif suit=='d': count2+=1 elif suit=='h': count3+=1 else: count4+=1 if count1==5 or count2==5 or count3==5 or count4==5: flush=flush+1 count5=count6=count7=count8=0 card1=random.choice([10,'j','q','k','a']) if suit=='s': count5+=1 elif suit=='d': count6+=1 elif suit=='h': count7+=1 else: count8+=1 if count5==5 or count6==5 or count7==5 or count8==5: royal=royal+1 print("number of flushes",flush) prob=float(flush)/float(n) print("prob of flush",prob) print("number of royal flushes",royal) prob1=float(royal)/float(n) print("prob of royal flush",prob1) t2=time.clock() process=round(t2-t1,2) print("prossess time",process,"sec")

It prints out something like this:

number of hand=100000

number of flushes 365

prob of flush 0.00365

number of royal flushes 0

prob of royal flush 0.0

prossess time 4.62 sec

I'm pretty sure there is a more effective way to figure out the probabilities of those ten hands. Please help.

Thanks.