[Tutor] (no subject)

steve clarke sclarkey101 at hotmail.com
Wed Nov 7 12:53:59 CET 2012


Hi, I am trying to write a programme to count how many times a random point lies within the positive sector of a circle. So far I can display if the point lies inside the area but I need something to allow me to count the total number of items that lie inside the area. My programme is:>>> import random>>> for i in range(10):	x = random.random()	y = random.random()	count = 0	if x*x + y*y < 1:		count = count + 1		print count

and I get a list down the screen like11111
depending on how many times a random point lies in the area. I am meant to do this with 10000 points so I can't simply count the 1's up like I can with 10. I have been looking on the internet but cant find anything that works yet. 
Thanks for your timeSteve Clarke 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121107/453575d0/attachment.html>


More information about the Tutor mailing list