【发布时间】:2022-06-17 12:01:17
【问题描述】:
import random
options = [1, -1, 2, -2, 3, -3, 4, -2]
total_points = 0
points_needed = 12
wins = 0
for c in range(1,100):
total_points = 0
for i in range(1,24):
r = random.choice(options)
print(f'Pick: {r}')
total_points += r
if total_points > points_needed:
wins += 1
print(f'Total Wins: {wins}')
这给了我大约 300 次的胜利,而 100 次胜利应该是最多的......我累了,我不知道出了什么问题
【问题讨论】:
-
它应该玩这个选项 100 次,看看用这些选项获胜的机会有多大
标签: python