Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1.  
  2. import random
  3.  
  4. bowl1 = 0
  5. bowl2 = 0
  6. bowl3 = 0
  7. prop1 =[]
  8. probBowl1 = []
  9. prop2 = []
  10. probBowl2 = []
  11. prop3 = []
  12. probBowl3 = []
  13. bolatepat1 = 0
  14. bolatepat2 = 0
  15. bolatepat3 = 0
  16. for i in range (1,10001):
  17. bowl = random.randint(1,6)
  18. if (bowl==1 or bowl ==2):
  19. bowl1+=1
  20. ball = random.randint(1,6)
  21. prop2.append (0)
  22. prop3.append (0)
  23. if (ball==1 or ball==2):
  24. bolatepat1 += 1
  25. temp1 = bolatepat1/ i
  26. temp2 = bowl1/ i
  27. temp3 = temp1*temp2
  28. prop1.append(temp3)
  29. suma = temp3+ prop2[len(prop2)-1] + prop3[len(prop3)-1]
  30. if (suma==0):
  31. probBowl1.append(0)
  32. else:
  33. probBowl1.append(temp3/suma)
  34. else:
  35. temp1 = bolatepat1/ i
  36. temp2 = bowl1/ i
  37. temp3 = temp1*temp2
  38. prop1.append(temp3)
  39. suma = temp3+ prop2[len(prop2)-1] + prop3[len(prop3)-1]
  40. if (suma==0):
  41. probBowl1.append(0)
  42. else:
  43. probBowl1.append(temp3/suma)
  44. elif(bowl==3):
  45. bowl2+=1
  46. ball = random.randint(1,6)
  47. prop1.append (0)
  48. prop3.append (0)
  49. if (ball==1):
  50. bolatepat2 += 1
  51. temp1 = bolatepat2/ i
  52. temp2 = bowl2/ i
  53. temp3 = temp1*temp2
  54. prop2.append(temp3)
  55. suma = temp3+ prop1[len(prop1)-1] + prop3[len(prop3)-1]
  56. if (suma==0):
  57. probBowl2.append(0)
  58. else:
  59. probBowl2.append(temp3/suma)
  60. else:
  61. temp1 = bolatepat2/ i
  62. temp2 = bowl2/ i
  63. temp3 = temp1*temp2
  64. prop2.append(temp3)
  65. suma = temp3+ prop1[len(prop1)-1] + prop3[len(prop3)-1]
  66. if (suma==0):
  67. probBowl2.append(0)
  68. else:
  69. probBowl2.append(temp3/suma)
  70.  
  71. elif (bowl==4 or bowl ==5 or bowl ==6):
  72. prop1.append (0)
  73. prop2.append (0)
  74. bowl3+=1
  75. ball = random.randint(1,6)
  76. if (ball==1 or ball==2 or ball==3 or ball==4 or ball==5):
  77. bolatepat3 += 1
  78. temp1 = bolatepat3/ i
  79. temp2 = bowl3/ i
  80. temp3 = temp1*temp2
  81. prop3.append(temp3)
  82. suma = temp3+ prop1[len(prop1)-1] + prop2[len(prop2)-1]
  83. if (suma==0):
  84. probBowl3.append(0)
  85. else:
  86. probBowl3.append(temp3/suma)
  87. else:
  88. temp1 = bolatepat3/ i
  89. temp2 = bowl3/ i
  90. temp3 = temp1*temp2
  91. prop3.append(temp3)
  92. suma = temp3+ prop1[len(prop1)-1] + prop2[len(prop2)-1]
  93. if (suma==0):
  94. probBowl3.append(0)
  95. else:
  96. probBowl3.append(temp3/suma)
  97.  
  98.  
  99. print (probBowl1[len(probBowl1)-1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement