--

I like Monte Carlo simulations. Here's a short Python program that shows the same numerical results, accurate to as many digits as desired if you increase the number of trials. (Be sure to replace the dots with spaces for correct indentation)...

import random

deck = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

vowels = "AEIOU"

trials = 1_000_000

hits = 0

for trial in range(trials):

....three_cards = random.sample(deck, 3)

....if any(card in vowels for card in three_cards):

........hits += 1

print(hits / trials)

--

--

John Clark Craig
John Clark Craig

Written by John Clark Craig

Author, inventor, entrepreneur — passionate about alternate energy, technology, UFOs, and how Python programming can help you hack your life.

No responses yet