TheAceHome

Untitled

Oct 22nd, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #4.2
  2. import random
  3. from random import randint
  4. import matplotlib
  5. import matplotlib.pyplot as plt
  6.  
  7. omega=[2,4,6]
  8. a=[]
  9. n,N=0,100000
  10. x1=[x for x in range(0,N,100)]
  11. x1.remove(x1[0])
  12. y1=[]
  13. for _ in range(N):
  14. for i in range(3):
  15. a.append(random.choice(omega))
  16. if 6 in a:
  17. n+=1
  18. if _ in x1:
  19. y1.append(n/_)
  20. a=[]
  21. print(n / N)
  22. plt.plot(x1, y1)
  23. plt.title('PLOT')
  24. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment