Current location - Training Enrollment Network - Mathematics courses - Mathematical python
Mathematical python
This is a math problem. I can simulate this situation. The more times I test, the closer I get to the correct answer. (Just close, after all, simulating this process)

# Encoding: utf-8

Import? Random?

def? Test(n, T):#n stands for taking n balls each? T stands for the number of tests.

Count? =? 0

count 1? =? 0

What time? count 1? & lt? t:

Answer? =? [0,0,0,0, 1, 1]#? 0 stands for white ball, 1 stands for black ball.

b? =? [0,0,0, 1, 1, 1, 1]

What if? int(n)? & lt=? Ryan (A):

list 1? =? Random sample (a, n)

For what? Me? Are you online? List 1:

A. Delete (1)

list2? =? Random sample (b, n)

For what? i 1? Are you online? Listing 2:

B. Delete (i 1)

B. Appendix (I)

A. Addition (i 1)

Print? A, b

count 1? +=? 1

What if? a.count(0)? ==? 4:

Count? +=? 1

Print? p? =? %d/%d'% (count, t)