Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. rings = 0
  2. from random import random
  3. socketchance = 0.1
  4. ringchance = 0.2
  5. l=[]
  6. count = 0
  7. while True:
  8. if random() < ringchance:
  9. if random() < socketchance:
  10. rings += 1
  11. if random() < ringchance:
  12. if random() < socketchance:
  13. rings += 1
  14. if random() < ringchance:
  15. if random() < socketchance:
  16. rings += 1
  17. count += 1
  18. if rings >= 5:
  19. # print ("Mecha done for the whole group in", count, "runs")
  20. l.append(count)
  21. print (sum(l)/len(l))
  22. rings = 0
  23. count = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement