Python Forum

Full Version: Complex Program with matplotlib - Python Challenge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I had this on my programming exam last week. I still don't get desired outcome. Wall

How would you solve it?

1 Randomly generate 10^4 points (x_i, y_i) where x_i and y_i are uniformly distributed on interval [-1,1].
2 Figure out: How many of these points are inside uniform circle M and calculate ratio R=4M/N.
3 In created script.py repeat this for different seeds (of a generator).
4 Export your file into file.dat in which there has to be two columns- seed and R.
5 In the same script show (for one random seed) earlier generated points: Points inside uniform circle are coloured red and outside ones are coloured blue.
6 Nicely arrange the result with added legend.
7 Export the graph into file graph.pdf.

Hint: use Matplotlib for points 5, and 6.
please show the code that's not working so we can point out where changes should be made.