```
#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)
```
- py轉exe
- py服務器
- py登錄
- py查詢
- 爬TB熱賣1017
- 爬TB分類1015
- 爬BD文庫1010
- 爬文庫924
- json917
- decode912
- 轉碼910
- radians829
- turtle827
- 畫葉子820
- 樹干815
- Turtle, mainloop718
- sorted716
- random711
- turtle.colormode709
- abs704
- begin_fill702
- randint,random627
- isalpha625
- keyword620
- compile618
- judge613
- list1.copy611
- random.choice606
- format_randint604
- save_csv528
- jieba523
- wordcloud521
- wordcloud516
- jieba.lcut514
- counts503
- format423
- 花瓣418
- strftime416
- turtle.fillcolor411
- random.random409
- pensize404
- 花蕊328
- input327
- eval_float320
- open319
- while314
- JCR影響因子313
- _to_chinese4_312
- encoding306
- read305
- flask1029