【问题标题】:Incorrect amount of wins being given给出的获胜数量不正确
【发布时间】: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


猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-12-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-11
  • 1970-01-01
相关资源
最近更新 更多