From 4ea98e5b40278f72f7311c4302c452a5d11dd34c Mon Sep 17 00:00:00 2001 From: chuttenmaier Date: Fri, 7 Nov 2025 09:32:00 -0500 Subject: [PATCH] The math and or numbers were easy for me to work with --- dice_stats.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dice_stats.py b/dice_stats.py index 83a99cb..52e6dc4 100644 --- a/dice_stats.py +++ b/dice_stats.py @@ -19,12 +19,24 @@ class FiveDice: return False return True + def is_three_of_a_kind(self): + for face in self.faces(): + if face != 3: + return False + return True + + def is_four_of_a_kind(self): + for face in self.faces(): + if face != 4: + return False + return True + dice = FiveDice() successes = 0 trials = 1000000 for trial in tqdm(range(trials)): dice.roll() - if dice.all_ones(): + if dice.is_four_of_a_kind(): successes += 1 print(successes/trials)