import random def call(times): i, total = 0, 0 while i < times: total += random.random() i+=1 print total / times call(99999)