💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
``` #import random from random import randint,random ``` ``` from random import randint times = input("请输入试验次数:") get_car_without_change = 0 get_car_with_change = 0 for i in range(times): doors =['thing','thing','thing'] car_id = randint(0,2) doors[car_id] = 'car' my_choice = randint(0,2) if my_choice == car_id: get_car_without_change += 1 if my_choice != car_id: get_car_with_change += 1 P_change = get_car_with_change/times P_Not_change = get_car_without_change/times print(P_change) print(P_Not_change) ``` ``` from random import randint times = int(input("请输入试验次数:")) print(type(times)) get_car_without_change = 0 get_car_with_change = 0 for i in range(10): doors =['thing','thing','thing'] car_id = randint(0,2) doors[car_id] = 'car' my_choice = randint(0,2) if my_choice == car_id: get_car_without_change += 1 if my_choice != car_id: get_car_with_change += 1 P_change = get_car_with_change/times P_Not_change = get_car_without_change/times print(P_change) print(P_Not_change) ``` ``` t = eval(input("请输入试验次数:")) print(t) ```