Created
June 12, 2013 07:23
-
-
Save kneth/5763426 to your computer and use it in GitHub Desktop.
Opgave 1A
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
antal_ens = 0 | |
for _ in range(0, 5000000): | |
centicubes = ['R', 'H', 'R'] | |
random.shuffle(centicubes) | |
c1 = centicubes.pop(random.randint(0, len(centicubes)-1)) | |
c2 = centicubes.pop(random.randint(0, len(centicubes)-1)) | |
if c1 == c2: | |
antal_ens += 1 | |
print antal_ens/5000000.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment