Practicing with algorithms and general concepts as i learn python. I made this script that generates a 5 card poker hand, it is trying to see how many times it can generate a royal flush, which is 10, J, Q, K, A all same suits. I can edit the amount of iterations, but the results seem a little inconsistent and I feel like I did something wrong I just cant tell so far since ive been working on too many projects today. thoughts? import random nums = ["A", "Q", "J", "K", "2", "3", "4", "5", "6", "7", "8", "9", "10"] suit = ["c", "d", "s", "h"] def hand_gen(): output_bucket = [] while len(output_bucket) != 5: chosen = random.choice(nums) + random.choice(suit) if chosen not in output_bucket: output_bucket.append(chosen) return output_bucket def royal(*kwargs): output = [] for arg in kwargs: output.append([f"10{arg}", f"J{arg}", f"Q{arg}", f"K{arg}", f"A{arg}"]) return output def check_royal(): hand = hand_gen() royal_flushes = royal('c', 'd', 'h', 's') for flushes in royal_flushes: if set(hand) == set(flushes): print(f"{hand} is a royal flush. matches {flushes}") return 1 else: pass if __name__ == "__main__": iterations = 2000000 while iterations != 0: check_royal() iterations -= 1 Continue reading...