This is probably trivial for anyone who really know how to calculate probabilities.
If you have a wheel like the one on "Wheel of Fortune" that has 12 segments, and only one of them is yellow, then the probability of hitting yellow with one spin of the wheel is one in twelve. What is the probability of hitting yellow at least once if you spin it three times?
To my way of thinking, it ought to be 3 in 12 (also known as 25%.) I may well be wrong. I ran a simulation with python that simulated this 1,000,000 times (one million times the 3 spin scenario, that's 3 million spins.) The result came up around 23%. It comes up 23% no matter how many times I repeat it.
Either I can't calculate probabilities worth a damn (quite likely) or the python random number generator is whacked (not really likely.)
Does anyone know what I'm doing wrong?
BTW: This was a homework assignment for my daughter. I can't follow the truly squirrelly method that they teach here in Germany (draw some kind of tree structure and count nodes and add or multiply according to some rules that aren't clear to me,) and she can't get the right answer either.
If anyone is interested, here's the python program I used for the simulation:
(The forum software keeps jacking around with the code. Remove the part that says rel="nofollow" - that line should just be target=6)
If you have a wheel like the one on "Wheel of Fortune" that has 12 segments, and only one of them is yellow, then the probability of hitting yellow with one spin of the wheel is one in twelve. What is the probability of hitting yellow at least once if you spin it three times?
To my way of thinking, it ought to be 3 in 12 (also known as 25%.) I may well be wrong. I ran a simulation with python that simulated this 1,000,000 times (one million times the 3 spin scenario, that's 3 million spins.) The result came up around 23%. It comes up 23% no matter how many times I repeat it.
Either I can't calculate probabilities worth a damn (quite likely) or the python random number generator is whacked (not really likely.)
Does anyone know what I'm doing wrong?
BTW: This was a homework assignment for my daughter. I can't follow the truly squirrelly method that they teach here in Germany (draw some kind of tree structure and count nodes and add or multiply according to some rules that aren't clear to me,) and she can't get the right answer either.
If anyone is interested, here's the python program I used for the simulation:
(The forum software keeps jacking around with the code. Remove the part that says rel="nofollow" - that line should just be target=6)
Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
def main():
n=1000000.0
count=0.0
target=6
for x in range(n):
a=random.randint(1,12)
b=random.randint(1,12)
c=random.randint(1,12)
if a==target or b==target or c==target:
count=count+1
print (count/n)
return 0
if __name__ == '__main__':
main()
Last edited:
