am1x icon

tmp006.py

am1x | PRO | 02/26/26 05:45:07 PM UTC | 0 ⭐ | 12175 👁️ | Never ⏰ | [Alex]
Python |

280 B

|

Cryptocurrency

|

0 👍

/

0 👎

import random
 
def proc(n):
    s1 = 0
    lims = [3, 3, 0]
    for _ in range(n):
        for i in range(len(lims)):
            s = 0
            while True:
                if random.choice((0, 0, 1)):
                    break
                s += 1
            if s >= lims[i]:
                s1 += s
                break
    return s1
 
 
n = 1000000
m = proc(n)
print(n, m, m / n)
        
        
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎