I am trying to append random values and hold it in another value from a dictionary. As for a flush you need to clarify suits, so I did so for the dictionary, then I wanted to add random values between 1-14 for a hand of five cards to see if it is all of the same suits. Then if so print its a flush then use count to print the probability of the number of hands it took to get a flush.
The issue I am having is appending the random dictionary values then checking if it is a flush, im not sure if the code I have will do so correctly because it was used for hardcoded values not a random generator now.
def flush():
count = 0
while (True):
values = {"2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "10":10, "J":11, "Q":12, "K":13, "A":14}
for i in range (5):
hand = values.append(random.choice([2,3,4,5,6,7,8,9,10,11,12,13,14]))
stop = False
for value in values:
suits = [h[1] for h in hand]
if len(set(suits)) == 1:
return True
else:
return False
if stop:
break
else:
count+=1
print(f'Count is {1/count}')