Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import matplotlib
- import matplotlib.pyplot as plt
- %matplotlib inline
- def A(N):
- n = 0
- for i in range(N):
- x = random.randint(1, 100)
- y = random.randint(1, 100)
- z = random.randint(1, 100)
- if x <= 5 or y <= 70 or z <= 31:
- n += 1
- return n/N
- N = 10000
- print("Answer:")
- print(A(N))
- x = [i for i in range(1, 10000, 100)]
- y1 = [A(i) for i in x]
- plt.plot(x[2:], y1[2:])
- plt.title('PLOT')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment