#function to calculate radioactivity given half-life formula
#r(t+delta_t) = r(t)*(1/2)**(delta_t/t_h):
#current_activity is r(t), elapsed_time is delta_t, half life is t_h
#elapsed_time and half_life need to be in same time units.
def get_new_activity( current_activity, elapsed_time, half_life):
answer = current_activity*0.5**(elapsed_time/half_life)
return answer
#initial activity in microcuries
r = 5.0
#time increment
deltat = 20.0
#half life in years
t12 = 30.0
#Print activities for various elapsed times
j = 0
while j<21:
t = j * deltat
print "Time is now", t, "Activity is now", get_new_activity(r, t, t12)
j += 1
print "Done."