Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- 3.11
- """
- from random import randint
- import matplotlib
- import matplotlib.pyplot as plt
- x1 = []
- y1 = []
- def experiment(N):
- n = 0
- for i in range(N):
- x = randint(0, 60)
- y = randint(0, 60)
- if (x + 10 >= y) and (y + 12 >= x):
- n += 1
- x1.append(x)
- y1.append(y)
- #else:
- #x2.append(x)
- #y2.append(y)
- return (n / N)
- print("Answer:")
- print(experiment(10000))
- print(len(x1), len(y1))
- plt.plot(x1, y1, linestyle="", marker="o", color = "g")
- #plt.plot(x2, y2, linestyle="", marker="o", color = "r")
- plt.title('PLOT')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement