Skip to content

Instantly share code, notes, and snippets.

@uktechreviews
Created February 22, 2017 15:39
Show Gist options
  • Save uktechreviews/673910559665f22b9a3d71e816853fdc to your computer and use it in GitHub Desktop.
Save uktechreviews/673910559665f22b9a3d71e816853fdc to your computer and use it in GitHub Desktop.
from random import randint
particles = [] ## create an empty list
results = [] ## create a blank list for the results
max_count = 100 ## start with this number of cubes
x_series = []
while (max_count > 1) :
for i in range (max_count): ## populate array with random dice throws
face = randint(1,6)
particles.append(face)
for items in particles: ## read the array back and remove 'face up'
if items == 6:
max_count -=1
particles = [] ## reset particles array
results.append(max_count)
for items in results: ## Read the results back
print (items)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment