Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1.  
  2. import random
  3. import numpy as np
  4.  
  5. bowl1 = 0
  6. bowl2 = 0
  7. bowl3 = 0
  8. prop1 = np.array ([])
  9. probBowl1 = np.array ([])
  10. prop2 = np.array ([])
  11. probBowl2 = np.array ([])
  12. prop3 = np.array ([])
  13. probBowl3 = np.array ([])
  14. bolatepat1 = 0
  15. bolatepat2 = 0
  16. bolatepat3 = 0
  17. for i in range (1,10001):
  18. bowl = random.randint(1,6)
  19. if (bowl==1 or bowl ==2):
  20. bowl1+=1
  21. ball = random.randint(1,6)
  22. if (ball==1 or ball==2):
  23. bolatepat1 += 1
  24. temp1 = np.divide (bolatepat1, i)
  25. temp2 = np.divide (bowl1, i)
  26. temp3 = np.multiply (temp1,temp2)
  27. prop1.append(temp3)
  28. sum = prop1 + prop2 + prop3
  29. probBowl1 = np.divide (prop1, sum)
  30. probBowl1.append(probBowl1)
  31. else:
  32. temp1 = np.divide (bolatepat1, i)
  33. temp2 = np.divide (bowl1, i)
  34. temp3 = np.multiply (temp1,temp2)
  35. prop1.append(temp3)
  36. sum = prop1 + prop2 + prop3
  37. probBowl1 = np.divide (prop1, sum)
  38. probBowl1.append(probBowl1)
  39. prop2.append (0)
  40. prop3.append (0)
  41. elif(bowl==3):
  42. bowl2+=1
  43. ball = random.randint(1,6)
  44. if (ball==1 or ball==2):
  45. bolatepat2 += 1
  46. prop2.append(bolatepat2/i)
  47. else:
  48. prop2.append(bolatepat2/i)
  49. prop1.append (0)
  50. prop3.append (0)
  51. elif (bowl==4 or bowl ==5 or bowl ==6):
  52. bowl3+=1
  53. ball = random.randint(1,6)
  54. if (ball==1 or ball==2):
  55. bolatepat3 += 1
  56. prop3.append(bolatepat3/i)
  57. else:
  58. prop3.append(bolatepat3/i)
  59. prop1.append(0)
  60. prop2.append (0)
  61.  
  62. print (probBowl1[len(probBowl1)-1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement