import random
from filecmp import cmp
import numpy as np
n = 100#迭代次数
x = 0 #中奖的次数
y = 0 #没中的次数
choicer = [1,2,3] #三个门为 1 2 3
tickets = [1,2,3] #奖品车所在的门
for i in range(1,n):
true = np.random.choice(choicer) #随机取得数值
faluse = np.random.choice(tickets)
if true == faluse: #判断取得数值是否相等
x = x + 1 #获奖次数+1
else:
y = y + 1 #未获奖次数+1
print(x)
print(y)
print(x/y) #打印中奖的概率