TheAceHome

Untitled

Oct 13th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. from random import randint
  2. import matplotlib
  3. import matplotlib.pyplot as plt
  4.  
  5. N=10000
  6. x1 = []
  7. y1 = []
  8. a,b=[],[]
  9. n = 0
  10. for i in range(N):
  11. x = randint(0, 60)
  12. y = randint(0, 60)
  13. x1.append(x)
  14. y1.append(y)
  15. if (x + 10 > y) and (y + 12 > x):
  16. n += 1
  17. a.append(x)
  18. b.append(y)
  19. if x == y:
  20. n += 1
  21. print(n/N)
  22.  
  23. plt.plot(a,b, linestyle="",marker="o")
  24. plt.title('PLOT')
  25. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment