import random
import time
u = 0
p = 0
times = 1000
time.clock()
for i in range (times):
a = random.randint(1,3)
if a==1:
u=u+1
b = random.randint(2,3)
c = random.choice([1,b])
if c==1:
p=p+1
print(u/times)
print(p/times)
转载于:https://www.cnblogs.com/yaohana/p/10732136.html