Practical part in PC-Room A1.4 & A1.1 (friday 11th) and A1.4 (monday 14th), Theoretical part Office Wim Van Criekinge

# Exam Schedule

Reply

Reply

import random print ("Let's calculate Pi\n") c=0 maxx=1000 for l in range(1,maxx): # print ("We're generating point %d" % (l)) x = random.uniform(0,1) y = random.uniform(0,1) # print ("(" + str(x) + "," + str(y) + ")",end="\n") r = x*x + y*y # print ("r = " + str(r)) if r < 1: # print ("In the circle",end="\n") c+=1 p = float(c)*4/float(l) print ("Pi estimate after " + str(maxx) + " iterations = " + str(p) + "\n")