I am trying to make a simple poker game where I would simulate each hand shown in the options as no pair, one pair, two pair, etc.
I am trying to print out the probability by using count to increment each time it deals a new hand
def twopair():
count = 0
while True:
cards = []
for i in range(5):
cards.append(random.choice([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]))
stop = False
counted_cards = Counter(cards)
two_most_common, count = zip(*counted_cards.most_common(2))
count_to_message = {
(1, 1): "Nothing",
(2, 1): "One Pair",
(3, 1): "Three of a Kind",
(4, 1): "Four of a Kind",
(5, 1): "Five of a Kind",
(2, 2): "Two Pairs",
(3, 2): "Full House",
}
msg = count_to_message[count]
print(msg)
if msg == "Two Pairs":
stop = True
break
#else:
# count+=1
#print(f'Count is {1/count}')
If you remove the #
it gives a error of cant concatenate a tuple with a int. What could i do to resolve this to make a count so i can divide count by 1 to give me the probability of getting two pairs?