Create a gist now

Instantly share code, notes, and snippets.

Embed
Modelling radioactive decay
#!/usr/bin/env python
from random import randint
particles = [] ## create an empty list
results = [] ## create a blank list
max_count = 100 ## start with this number of cubes
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 list
results.append(max_count)
graph = open("decay_graph", "w")
print ("The results from the experiment")
print ("--- ------- ---- --- ----------")
print ("\n")
c=1
for items in results:
graph.write(str(c) + " " + str(items) +"\n")
print (str(c) + " " + str(items))
c +=1
graph.close()
@uktechreviews

This comment has been minimized.

Show comment
Hide comment
@uktechreviews

uktechreviews Feb 22, 2017

first commit

Owner

uktechreviews commented Feb 22, 2017

first commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment